Hi Oleg
Yes, I see.. it would have been great if FileChannel.transferFrom()
returned -1 as well, without hiding that underneath the JDK layer, when
actually encountered
Absolutely. I see no reason why FileChannel#transferFrom() should be
behaving this way. This looks like a bug to me
I too thought so, but as per the current Javadoc, I do not expect Oracle to identify this as a bug and change this behaviour
What if we make our LengthDelimitedEncoder try to read into the session
buffer, if bytes read is found to be zero? This may not be optimal, but
at least, results in the correct operation.

                  bytesRead = dst.transferFrom(this.channel, position,
count);
                  if (bytesRead == 0) {
                      bytesRead = this.buffer.fill(this.channel);
                  }
I would try reading into a ByteBuffer with zero remaining capacity.
Hopefully this would give us channel status without moving any data into
the buffer.
Thats a great idea.. I'll try that, and maybe we could incorporate that into the trunk later

regards
asankha


--
Asankha C. Perera
AdroitLogic, http://adroitlogic.org

http://esbmagic.blogspot.com




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to