Skip to content

Most visited

Recently visited

navigation
Added in API level 1

AbstractSelector

public abstract class AbstractSelector
extends Selector

java.lang.Object
   ↳ java.nio.channels.Selector
     ↳ java.nio.channels.spi.AbstractSelector


AbstractSelector is the base implementation class for selectors. It realizes the interruption of selection by begin and end. It also holds the cancellation and the deletion of the key set.

Summary

Protected constructors

AbstractSelector(SelectorProvider selectorProvider)

Public methods

final void close()

Closes this selector.

final boolean isOpen()

Returns true if this selector is open.

final SelectorProvider provider()

Returns this selector's provider.

Protected methods

final void begin()

Indicates the beginning of a code section that includes an I/O operation that is potentially blocking.

final Set<SelectionKey> cancelledKeys()

Returns this channel's set of canceled selection keys.

final void deregister(AbstractSelectionKey key)

Deletes the key from the channel's key set.

final void end()

Indicates the end of a code section that has been started with begin() and that includes a potentially blocking I/O operation.

abstract void implCloseSelector()

Implements the closing of this channel.

abstract SelectionKey register(AbstractSelectableChannel channel, int operations, Object attachment)

Registers channel with this selector.

Inherited methods

From class java.nio.channels.Selector
From class java.lang.Object
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Protected constructors

AbstractSelector

Added in API level 1
AbstractSelector (SelectorProvider selectorProvider)

Parameters
selectorProvider SelectorProvider

Public methods

close

Added in API level 1
void close ()

Closes this selector. This method does nothing if this selector is already closed. The actual closing must be implemented by subclasses in implCloseSelector().

Throws
IOException

isOpen

Added in API level 1
boolean isOpen ()

Returns true if this selector is open.

Returns
boolean true if this selector is not closed, false otherwise.

provider

Added in API level 1
SelectorProvider provider ()

Returns this selector's provider.

Returns
SelectorProvider the provider of this selector.

Protected methods

begin

Added in API level 1
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 end(boolean) method.

cancelledKeys

Added in API level 1
Set<SelectionKey> cancelledKeys ()

Returns this channel's set of canceled selection keys.

Returns
Set<SelectionKey>

deregister

Added in API level 1
void deregister (AbstractSelectionKey key)

Deletes the key from the channel's key set.

Parameters
key AbstractSelectionKey

end

Added in API level 1
void end ()

Indicates the end of a code section that has been started with begin() and that includes a potentially blocking I/O operation.

implCloseSelector

Added in API level 1
void implCloseSelector ()

Implements the closing of this channel.

Throws
IOException

register

Added in API level 1
SelectionKey register (AbstractSelectableChannel channel, 
                int operations, 
                Object attachment)

Registers channel with this selector.

Parameters
channel AbstractSelectableChannel
operations int: the interest set of channel.
attachment Object: the attachment for the selection key.
Returns
SelectionKey the key related to the channel and this selector.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.