Build 1.0_r1(from source)

java.nio.channels.spi
Class AbstractSelector

java.lang.Object
  extended by java.nio.channels.Selector
      extended by java.nio.channels.spi.AbstractSelector

public abstract class AbstractSelector
extends Selector

Abstract class for selectors.

This class realizes the interruption of selection by begin and end. It also holds the cancelled and the deletion of the key set.


Constructor Summary
protected AbstractSelector(SelectorProvider selectorProvider)
          Constructor for this class.
 
Method Summary
protected  void begin()
          This starts a potentially blocking I/O operation
(package private)  void cancel(SelectionKey key)
           
protected  Set<SelectionKey> cancelledKeys()
          Returns the cancelled key set of this channel.
 void close()
          Closes this channel.
protected  void deregister(AbstractSelectionKey key)
          Deletes the key from channel's key set.
protected  void end()
          This ends a potentially blocking I/O operation
protected abstract  void implCloseSelector()
          Implements the closing of this channel.
 boolean isOpen()
          Tells whether this selector is open.
 SelectorProvider provider()
          Returns the SelectorProvider of this channel.
protected abstract  SelectionKey register(AbstractSelectableChannel channel, int operations, Object attachment)
          Registers a channel to 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 selectorProvider)
Constructor for this class.

Parameters:
selectorProvider - A instance of SelectorProvider
Method Detail

close

public final void close()
                 throws IOException
Closes this channel.

Specified by:
close in class Selector
Throws:
IOException - if I/O error occurs
See Also:
Selector.close()

implCloseSelector

protected abstract void implCloseSelector()
                                   throws IOException
Implements the closing of this channel.

Throws:
IOException - If some I/O exception occurs.

isOpen

public final boolean isOpen()
Description copied from class: Selector
Tells whether this selector is open.

Specified by:
isOpen in class Selector
Returns:
true if this selector is not closed
See Also:
Selector.isOpen()

provider

public final SelectorProvider provider()
Returns the SelectorProvider of this channel.

Specified by:
provider in class Selector
Returns:
the provider of this selector
See Also:
Selector.provider()

cancelledKeys

protected final Set<SelectionKey> cancelledKeys()
Returns the cancelled key set of this channel.

Returns:
The cancelled key set.

register

protected abstract SelectionKey register(AbstractSelectableChannel channel,
                                         int operations,
                                         Object attachment)
Registers a channel to this selector.

Parameters:
channel - The channel to be registered.
operations - The interest set.
attachment - The attachment of the key.
Returns:
The key related with the channel and the selector.

deregister

protected final void deregister(AbstractSelectionKey key)
Deletes the key from channel's key set.

Parameters:
key - The key.

begin

protected final void begin()
This starts a potentially blocking I/O operation


end

protected final void end()
This ends a potentially blocking I/O operation


cancel

void cancel(SelectionKey key)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature