java.lang.Objectjava.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.SelectableChannel
java.nio.channels.spi.AbstractSelectableChannel
All Implemented Interfaces:
Channel, InterruptibleChannel
Direct Known Subclasses:
ServerSocketChannel, SinkChannel, SourceChannel, DatagramChannel, SocketChannel
This class defines methods that handle the mechanics of channel registration, deregistration, and closing. It maintains the current blocking mode of this channel as well as its current set of selection keys. It performs all of the synchronization required to implement the java.nio.channels.SelectableChannel specification. Implementations of the abstract protected methods defined in this class need not synchronize against other threads that might be engaged in the same operations.
Mark - ReinholdMike - McCloskeyJSR-51 - Expert Group1.4 - | Field Summary | ||
|---|---|---|
| boolean | blocking | |
| Constructor: |
|---|
|
| Method from java.nio.channels.spi.AbstractSelectableChannel Summary: |
|---|
| blockingLock, configureBlocking, implCloseChannel, implCloseSelectableChannel, implConfigureBlocking, isBlocking, isRegistered, keyFor, provider, register, removeKey |
| Methods from java.nio.channels.SelectableChannel: |
|---|
| blockingLock, configureBlocking, isBlocking, isRegistered, keyFor, provider, register, register, validOps |
| Methods from java.nio.channels.spi.AbstractInterruptibleChannel: |
|---|
| begin, blockedOn, close, end, implCloseChannel, isOpen |
| Methods from java.lang.Object: |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from java.nio.channels.spi.AbstractSelectableChannel Detail: |
|---|
|
If the given blocking mode is different from the current blocking mode then this method invokes the implConfigureBlocking method, while holding the appropriate locks, in order to change the mode. |
This method, which is specified in the AbstractInterruptibleChannel class and is invoked by the close method, in turn invokes the implCloseSelectableChannel method in order to perform the actual work of closing this channel. It then cancels all of this channel's keys. |
This method is invoked by the close method in order to perform the actual work of closing the channel. This method is only invoked if the channel has not yet been closed, and it is never invoked more than once. An implementation of this method must arrange for any other thread that is blocked in an I/O operation upon this channel to return immediately, either by throwing an exception or by returning normally. |
This method is invoked by the configureBlocking method in order to perform the actual work of changing the blocking mode. This method is only invoked if the new mode is different from the current mode. |
|
|
|
|
This method first verifies that this channel is open and that the given initial interest set is valid. If this channel is already registered with the given selector then the selection key representing that registration is returned after setting its interest set to the given value. Otherwise this channel has not yet been registered with the given selector, so the register method of the selector is invoked while holding the appropriate locks. The resulting key is added to this channel's key set before being returned. |
|