public abstract class AbstractSelectableChannel extends SelectableChannel
Modifier | Constructor and Description |
---|---|
protected |
AbstractSelectableChannel(SelectorProvider provider)
Initializes the channel
|
Modifier and Type | Method and Description |
---|---|
Object |
blockingLock()
Retrieves the object upon which the configureBlocking and register
methods synchronize.
|
SelectableChannel |
configureBlocking(boolean blocking)
Adjusts this channel's blocking mode.
|
protected void |
implCloseChannel()
Closes this channel.
|
protected abstract void |
implCloseSelectableChannel()
Closes this selectable channel.
|
protected abstract void |
implConfigureBlocking(boolean blocking)
Adjusts this channel's blocking mode.
|
boolean |
isBlocking()
Tells whether or not every I/O operation on this channel will block
until it completes.
|
boolean |
isRegistered()
Tells whether or not this channel is currently registered with
any selectors.
|
SelectionKey |
keyFor(Selector selector)
Retrieves the key representing the channel's registration with the
given selector.
|
SelectorProvider |
provider()
Returns the provider that created this channel.
|
SelectionKey |
register(Selector selin,
int ops,
Object att)
Registers this channel with the given selector, returning a selection key.
|
register, validOps
begin, close, end, isOpen
protected AbstractSelectableChannel(SelectorProvider provider)
provider
- the provider that created this channelpublic final Object blockingLock()
blockingLock
in class SelectableChannel
public final SelectableChannel configureBlocking(boolean blocking) throws IOException
configureBlocking
in class SelectableChannel
blocking
- true if blocking should be enabled, false otherwiseIOException
- If an error occursprotected final void implCloseChannel() throws IOException
implCloseChannel
in class AbstractInterruptibleChannel
IOException
- If an error occursprotected abstract void implCloseSelectableChannel() throws IOException
IOException
- If an error occursprotected abstract void implConfigureBlocking(boolean blocking) throws IOException
blocking
- true if blocking should be enabled, false otherwiseIOException
- If an error occurspublic final boolean isBlocking()
isBlocking
in class SelectableChannel
public final boolean isRegistered()
isRegistered
in class SelectableChannel
public final SelectionKey keyFor(Selector selector)
keyFor
in class SelectableChannel
selector
- the selector to get a selection key forpublic final SelectorProvider provider()
provider
in class SelectableChannel
public final SelectionKey register(Selector selin, int ops, Object att) throws ClosedChannelException
register
in class SelectableChannel
selin
- the seletor to useops
- the interested operationsatt
- an attachment for the returned selection keyClosedChannelException
- If the channel is already closed.IllegalBlockingModeException
- If the channel is configured in
blocking mode.