java.nio.channels.spi
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSelector(SelectorProvider provider)
Initializes a new instance of this class. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
begin()
Marks the beginning of an I/O operation that might block indefinitely. |
protected Set<SelectionKey> |
cancelledKeys()
Retrieves this selector's cancelled-key set. |
void |
close()
Closes this selector. |
protected void |
deregister(AbstractSelectionKey key)
Removes the given key from its channel's key set. |
protected void |
end()
Marks the end of an I/O operation that might block indefinitely. |
protected abstract void |
implCloseSelector()
Closes this selector. |
boolean |
isOpen()
Tells whether or not this selector is open. |
SelectorProvider |
provider()
Returns the provider that created this channel. |
protected abstract SelectionKey |
register(AbstractSelectableChannel ch,
int ops,
Object att)
Registers the given channel with this selector. |
| Methods inherited from class java.nio.channels.Selector |
|---|
keys, open, select, select, selectedKeys, selectNow, wakeup |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
AbstractSelector
protected AbstractSelector(SelectorProvider provider)
- Initializes a new instance of this class.
| Method Detail |
|---|
close
public final void close()
throws IOException
- Closes this selector.
If the selector has already been closed then this method returns immediately. Otherwise it marks the selector as closed and then invokes the
implCloseSelectormethod in order to complete the close operation. - Throws:
IOException- If an I/O error occurs
implCloseSelector
protected abstract void implCloseSelector()
throws IOException
- Closes this selector.
This method is invoked by the
closemethod in order to perform the actual work of closing the selector. This method is only invoked if the selector 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 a selection operation upon this selector to return immediately as if by invoking the
wakeupmethod. - Throws:
IOException- If an I/O error occurs while closing the selector
isOpen
public final boolean isOpen()
- Description copied from class:
Selector - Tells whether or not this selector is open.
- Returns:
- true if, and only if, this selector is open
provider
public final SelectorProvider provider()
- Returns the provider that created this channel.
- Returns:
- The provider that created this channel
cancelledKeys
protected final Set<SelectionKey> cancelledKeys()
- Retrieves this selector's cancelled-key set.
This set should only be used while synchronized upon it.
- Returns:
- The cancelled-key set
register
protected abstract SelectionKey register(AbstractSelectableChannel ch, int ops, Object att)
- Registers the given channel with this selector.
This method is invoked by a channel's
registermethod in order to perform the actual work of registering the channel with this selector. - Parameters:
ch- The channel to be registeredops- The initial interest set, which must be validatt- The initial attachment for the resulting key- Returns:
- A new key representing the registration of the given channel with this selector
deregister
protected final void deregister(AbstractSelectionKey key)
- Removes the given key from its channel's key set.
This method must be invoked by the selector for each channel that it deregisters.
- Parameters:
key- The selection key to be removed
begin
protected final void begin()
- Marks the beginning of an I/O operation that might block indefinitely.
This method should be invoked in tandem with the
endmethod, using a try ... finally block as shown above, in order to implement interruption for this selector.Invoking this method arranges for the selector's
wakeupmethod to be invoked if a thread'sinterruptmethod is invoked while the thread is blocked in an I/O operation upon the selector.
end
protected final void end()
- Marks the end of an I/O operation that might block indefinitely.
This method should be invoked in tandem with the
beginmethod, using a try ... finally block as shown above, in order to implement interruption for this selector.
|
Java™ Platform Standard Ed. 7 DRAFT ea-b59 |
|||||||||
| PREV CLASS NEXT CLASS | NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
