Are array elements correctly published between workers?
Suppose I have a large array (of any type of atomic data, therefore not long or double ),
- I create a worker that fills the array, which I pass it to the contructor,
- I transfer the employee to the executor and wait for it to be completed (for example, using
future.get() ). The worker returns nothing. It just populates my array. - Then I immediately create and send another worker with the same contructor array in it. Does he see the latest meanings?
In other words, did it guarantee that the last record of the previous employee would occur before the first reading of the next employee?
Should I instead (or for best practice or something else) allow the first worker to return the array, even if the link is the same as I already have?
[Edit] Some prerequisites: I use byte arrays or short arrays that represent images and use up to 500,000,000 elements each. I am doing simple arithmetic for each element.
source share