Methods Summary |
---|
protected final void | begin()Indicates the beginning of a code section that includes an I/O operation
that is potentially blocking. After this operation, the application
should invoke the corresponding {@code end(boolean)} method.
// FIXME: be accommodate before VM actually provides
// setInterruptAction method
if (AbstractInterruptibleChannel.setInterruptAction != null) {
try {
AbstractInterruptibleChannel.setInterruptAction.invoke(Thread
.currentThread(), new Object[] { new Runnable() {
public void run() {
AbstractSelector.this.wakeup();
}
} });
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
void | cancel(java.nio.channels.SelectionKey key)
synchronized (cancelledKeysSet) {
cancelledKeysSet.add(key);
}
|
protected final java.util.Set | cancelledKeys()Returns this channel's set of canceled selection keys.
return cancelledKeysSet;
|
public final synchronized void | close()Closes this selector. This method does nothing if this selector is
already closed. The actual closing must be implemented by subclasses in
{@code implCloseSelector()}.
if (isOpen) {
isOpen = false;
implCloseSelector();
}
|
protected final void | deregister(java.nio.channels.spi.AbstractSelectionKey key)Deletes the key from the channel's key set.
((AbstractSelectableChannel) key.channel()).deregister(key);
key.isValid = false;
|
protected final void | end()Indicates the end of a code section that has been started with
{@code begin()} and that includes a potentially blocking I/O operation.
// FIXME: be accommodate before VM actually provides
// setInterruptAction method
if (AbstractInterruptibleChannel.setInterruptAction != null) {
try {
AbstractInterruptibleChannel.setInterruptAction.invoke(Thread
.currentThread(), new Object[] { null });
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
protected abstract void | implCloseSelector()Implements the closing of this channel.
|
public final boolean | isOpen()Indicates whether this selector is open.
return isOpen;
|
public final java.nio.channels.spi.SelectorProvider | provider()Gets this selector's provider.
return provider;
|
protected abstract java.nio.channels.SelectionKey | register(java.nio.channels.spi.AbstractSelectableChannel channel, int operations, java.lang.Object attachment)Registers a channel with this selector.
|