java.nio.channels.spi

Class AbstractSelector

public abstract class AbstractSelector extends Selector

Constructor Summary
protected AbstractSelector(SelectorProvider provider)
Initializes the slector.
Method Summary
protected voidbegin()
Marks the beginning of an I/O operation that might block indefinitely.
protected Set<SelectionKey>cancelledKeys()
Returns the cancelled keys set.
voidclose()
Closes the channel.
protected voidderegister(AbstractSelectionKey key)
Deregisters the given selection key.
protected voidend()
Marks the end of an I/O operation that might block indefinitely.
protected abstract voidimplCloseSelector()
Closes the channel.
booleanisOpen()
Tells whether this channel is open or not.
SelectorProviderprovider()
Returns the provider for this selector object.
protected abstract SelectionKeyregister(AbstractSelectableChannel ch, int ops, Object att)
Registers a channel for the selection process.

Constructor Detail

AbstractSelector

protected AbstractSelector(SelectorProvider provider)
Initializes the slector.

Parameters: provider the provider that created this selector

Method Detail

begin

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

cancelledKeys

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

Returns: the cancelled keys set

close

public final void close()
Closes the channel.

Throws: IOException If an error occurs

deregister

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

Parameters: key the key to deregister

end

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

implCloseSelector

protected abstract void implCloseSelector()
Closes the channel.

Throws: IOException if an error occurs

isOpen

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

Returns: true if channel is open, false otherwise.

provider

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

Returns: the SelectorProvider object that created this seletor

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