Pull/78 COMPRESS-485 + Substituting 'synchronized' with faster and fully thread-safe collections 'ConcurrentLinkedDeque' and iterators.#79
Conversation
this will ease Reproducible Builds when creating zip or jar archives thanks to Arnaud Nauwynck for the great help
…ions 'ConcurrentLinkedDeque' and iterators.
|
Before #78 the Actually I looked through the history and initially we didn't synchronize the iterator when writing, this has been added as "recommended practice" via https://issues.apache.org/jira/browse/COMPRESS-430 - so we never really cared whether adding new threads while writing would lead to a defined result. |
|
Hi @bodewig , I have to check the code by myself again and rebase the branch since it is 3 months old change. |
|
@bodewig
Since now, I am refering to before #78 .
The methods ( If you want to prevent Regarding (2): |
|
Thanks @Tibor17 Actually I've more or less been thinking out loud and not raising issues. I was trying to figure out whether the What I meant with the first part was that if you added new threads once No, I don't think we need to exclude the methods from each other. The class has a very clear usage pattern of two distinct phases:
and it should be clear that the result of calling I am aware of the iteration guarantees of |
|
oh, you don't need to rebase at all. I just realized all your changes have been pat of a distinct commit I could pick out of the PR and apply it separately. Sorry. |
|
merged, many thanks again. |
|
@bodewig |
|
s/non-blocking/lock-free/g 🤦♂️ |
One
ArrayListwas synchronized and another was not.In this concurrent access. Considering wekanesses of memory model this may produce sporadic NPE (so that retrieved Future may not be visible in another thread)
Using synchronization would avoid it but why to use it in such simple critical sections today if we have concurrent collections in Java 1.5+.
So used
ConcurrentLinkedDequeueand that's it. Easy.