Clarification on AbstractInterruptibleChannel#end(), possible bug?
Alan Bateman
Alan.Bateman at oracle.com
Mon Jan 16 03:29:00 PST 2012
On 16/01/2012 11:10, André Bargull wrote:
> java.nio.channels.spi.AbstractInterruptibleChannel#end() contains the
> following lines of code:
>> Thread interrupted = this.interrupted;
>> if (interrupted != null && interrupted == Thread.currentThread()) {
>> interrupted = null;
>> throw new ClosedByInterruptException();
>> }
>
> The assignment "interrupted = null" clearly doesn't make any sense
> here. I guess it is supposed to be "this.interrupted = null"?
You're right, this isn't needed and could be this.interrupted = null to
avoid other threads doing I/O on the channel from needing to check if
they are interrupted.
-Alan.
More information about the nio-dev
mailing list