Java Reference
In-Depth Information
is absolutely essential in all cases, but it doesn't hurt. You do this by invoking the key's
cancel()
method:
public
abstract
void
cancel
()
However, this step is only necessary if you haven't closed the channel. Closing a channel
automatically deregisters all keys for that channel in all selectors. Similarly, closing a
selector invalidates all keys in that selector.