Hello,

Even when a stream is not thread safe I try at least to make close() 
safe/atomic as aborts and finalizers or shutdown hooks are natural sources for 
concurrency – all using close().

Using a AtomicBoolean or flag is good for that.

(However I guess it is less problematic for memory resources)


Gruss
Bernd
-- 
http://bernd.eckenfels.net
>From Win 10 Mobile

Von: M N
Gesendet: Donnerstag, 20. Oktober 2016 23:11
An: dev@commons.apache.org
Betreff: Re: [compress] Added in-memory support for zip and 7z

Hi Stefan,

I have created tests for SeekableInMemoryByteChannel and spot small error.
Attached is a patch with tests and proposed fix.

Regarding thread safety I think would be more clear to remove volatile and 
document a class as not thread safe.
I think the need for thread safe SeekableInMemoryByteChannel will be a rare 
case.

Cheers,
Maciej

Reply via email to