AsynchronousCloseException when closing a channel

Alan Bateman Alan.Bateman at oracle.com
Mon Sep 5 01:11:19 PDT 2011


Gian Franco Zabarino wrote:
> Hi everybody, I found myself on a situation where I'm getting an 
> AsynchronousCloseException, when calling to 
> AsynchronousSocketChannel.close() method. I'm using JRE 1.7.0-b147, on 
> Ubuntu server 64-bits. the call to the close method is made when an 
> attempt for reading the channel is failed, inside the failed method of 
> the read completionhandler. Is this normal behavior? This is the 
> thread stack of the exception:
>
> java.nio.channels.AsynchronousCloseException
>         at 
> sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishRead(Unknown Source)
>         at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(Unknown 
> Source)
>         at 
> sun.nio.ch.UnixAsynchronousSocketChannelImpl.implClose(Unknown Source)
>         at sun.nio.ch.AsynchronousSocketChannelImpl.close(Unknown Source)
>         at ... (project classes)
>
> Thank you for your time. Greetings
>
> Gian Franco Zabarino
>
If you close a channel with outstanding I/O operations then they are 
required to fail with an AsynchronousCloseException. So yes, this is 
normal but point taken that the stack trace is a bit confusing because 
it makes it look like the close is failing. It may be less confusing if 
we discard the stack trace (which is done in one or two places, but not 
consistently).

-Alan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20110905/bcc0225c/attachment.html 


More information about the nio-dev mailing list