AbstractInterruptibleChannel#close / tracking resource leaks

Robert Muir rcmuir at gmail.com
Thu Sep 10 01:04:27 UTC 2015

Thank you very much: this works.

You are right, I was very afraid because the two close methods have
different semantics around them, so it seemed incorrect to do this...
sorry for the noise.

On Wed, Sep 9, 2015 at 7:53 PM, Brian Burkhalter
<brian.burkhalter at oracle.com> wrote:
> 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?

More information about the nio-dev mailing list