garydgregory commented on PR #784:
URL: https://github.com/apache/commons-io/pull/784#issuecomment-3316288913

   > Hi @garydgregory,
   > 
   > I noticed you just added 
[`ArraySeekableByteChannel`](https://github.com/apache/commons-io/blob/master/src/main/java/org/apache/commons/io/channels/ByteArraySeekableByteChannel.java)
 from Commons Compress into IO. I was considering doing the same, but ended up 
writing a fresh implementation because the original class doesn’t fully meet 
the NIO channel concurrency contract:
   > 
   > * 
[`Channel#close()`](https://docs.oracle.com/javase/8/docs/api/java/nio/channels/Channel.html#close--)
 calls must be serialized, and the closed state must be immediately visible to 
other threads. This is correctly handled in `ByteArraySeekableByteChannel`.
   > * 
[`ReadableByteChannel#read(...)`](https://docs.oracle.com/javase/8/docs/api/java/nio/channels/ReadableByteChannel.html#read-java.nio.ByteBuffer-)
 invocations must be serialized: BASBC does not enforce this.
   > * 
[`WritableByteChannel#write(...)`](https://docs.oracle.com/javase/8/docs/api/java/nio/channels/WritableByteChannel.html#write-java.nio.ByteBuffer-)
 invocations must also be serialized: BASBC doesn’t enforce this either.
   
   Hi @ppkarwasz 
   
   Yes, you're right of course 😄 
   Please see git master for the classic reentrant lock approach.
   
   Would you mind providing any additional modifications to 
`ByteArraySeekableByteChannel` either here or separately?
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to