Tibor17 commented on issue #79: Pull/78  COMPRESS-485 + Substituting 
'synchronized' with faster and fully thread-safe collections 
'ConcurrentLinkedDeque' and iterators.
URL: https://github.com/apache/commons-compress/pull/79#issuecomment-519423686
 
 
   @bodewig 
   You have opened two things, but sorry I have to say, they are not related 
and here is my explanation why:
   1. locking within private/public methods
   2. synchronized iterators
   
   Since now, I am refering to before #78 .
   Regarding (1) you mentioned:
   
   > synchronized would ensure you couldn't spin off new threads and add 
entries to them while writing or closing
   
   The methods (`addArchiveEntry` and `submit`) and `writeTo` were not mutually 
exclusive. 
   If we want to exclusive then we should fire another PR for that.
   
   If you want to prevent `writeTo` from double/parallel call, we can do this
   `if (es.isShutdown()) throw ...Exception`.
   Locking all 3 methods can be done with `AtomicBoolean` but that needs to see 
example.
   
   Regarding (2):
   It is old style to use collections wrapped in `synchronizedList()` and use 
iterators wrapped within `synchronized (streams) {}`. In modern collections 
`ConcurrentLinkedDequeue` is beneficial because it does not require any 
external locking.
   There was also one issue because the variable `futures` was not synchronized 
collection.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to