AbstractInterruptibleChannel#close / tracking resource leaks

Brian Burkhalter brian.burkhalter at oracle.com
Wed Sep 9 23:53:38 UTC 2015


Hello Robert,

Are the methods of the underlying FileChannel instance (“delegate”) ever accessed directly after it is used to create the FilterFileChannel? If not, why could you not simply do this:

@Override
protected void implCloseChannel() throws IOException {
    delegate.close();
}

All AbstractInterruptibleChannel.close() does is to obtain an internal lock, check whether the channel is already closed, and if not call implCloseChannel(). If the underlying FileChannel is not accessed separately once the container is created it’s not immediately clear to me at least how there could be contention although I could easily be missing something. I do understand that this is not strict interposition which is what it looks like you are after.

Regards,

Brian

On Sep 9, 2015, at 4:03 PM, Robert Muir <rcmuir at gmail.com> wrote:

> Is there a better way we can do this, or something that could be
> improved here? 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20150909/1ee21a41/attachment.html>


More information about the nio-dev mailing list