java.nio.channels.MembershipKey API
Alan Bateman
Alan.Bateman at Sun.COM
Thu Nov 27 12:28:45 PST 2008
David M. Lloyd wrote:
> :
> Well, that wasn't my point. I don't think anyone would reasonably
> expect a multicast membership key to outlive the channel. My point is
> that, given that there's a standard resource cleanup I/O interface
> (Closeable), and that drop() conforms to it exactly apart from the
> name, why not use it?
I appreciate this wasn't your point but your comment helped to highlight
that an explicit statement to that effect was missing.
I agree that implementing Closeable to work with resource clean-up
facilities is good (we need to retrofit Selector implement it, as you
pointed out a few months ago). However, I don't see a big need for
classes such as FileLock, SelectionKey, and MembershipKey to implement
it. These are tokens rather than data sources or destinations. I would
expect the channel to be registered with the clean-up facility; when its
close method is invoked, then it releases all resources and invalidates
all the associated token objects.
-Alan.
More information about the nio-dev
mailing list