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


Constructor Summary
protected AbstractSelector(SelectorProvider provider)
          Initializes the slector.
 
Method Summary
protected  void begin()
          Marks the beginning of an I/O operation that might block indefinitely.
protected  Set<SelectionKey> cancelledKeys()
          Returns the cancelled keys set.
 void close()
          Closes the channel.
protected  void deregister(AbstractSelectionKey key)
          Deregisters the given selection key.
protected  void end()
          Marks the end of an I/O operation that might block indefinitely.
protected abstract  void implCloseSelector()
          Closes the channel.
 boolean isOpen()
          Tells whether this channel is open or not.
 SelectorProvider provider()
          Returns the provider for this selector object.
protected abstract  SelectionKey register(AbstractSelectableChannel ch, int ops, Object att)
          Registers a channel for the selection process.
 
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 the slector.

Parameters:
provider - the provider that created this selector
Method Detail

close

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

Specified by:
close in class Selector
Throws:
IOException - If an error occurs

isOpen

public final boolean isOpen()
Tells whether this channel is open or not.

Specified by:
isOpen in class Selector
Returns:
true if channel is open, false otherwise.

begin

protected final void begin()
Marks the beginning of an I/O operation that might block indefinitely.


end

protected final void end()
Marks the end of an I/O operation that might block indefinitely.


provider

public final SelectorProvider provider()
Returns the provider for this selector object.

Specified by:
provider in class Selector
Returns:
the SelectorProvider object that created this seletor

cancelledKeys

protected final Set<SelectionKey> cancelledKeys()
Returns the cancelled keys set.

Returns:
the cancelled keys set

implCloseSelector

protected abstract void implCloseSelector()
                                   throws IOException
Closes the channel.

Throws:
IOException - if an error occurs

register

protected abstract SelectionKey register(AbstractSelectableChannel ch,
                                         int ops,
                                         Object att)
Registers a channel for the selection process.

Parameters:
ch - the channel register
ops - the interested operations
att - an attachement to the selection key
Returns:
the registered selection key

deregister

protected final void deregister(AbstractSelectionKey key)
Deregisters the given selection key.

Parameters:
key - the key to deregister