Class Overview
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
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.
|
[Expand]
Inherited Methods |
From class
java.nio.channels.Selector
abstract
void
|
close()
Closes this selector.
|
abstract
boolean
|
isOpen()
Indicates whether this selector is open.
|
abstract
Set<SelectionKey>
|
keys()
Gets the set of registered keys.
|
static
Selector
|
open()
|
abstract
SelectorProvider
|
provider()
Gets the provider of this selector.
|
abstract
int
|
select()
Detects if any of the registered channels is ready for I/O operations
according to its interest set .
|
abstract
int
|
select(long timeout)
Detects if any of the registered channels is ready for I/O operations
according to its interest set .
|
abstract
int
|
selectNow()
Detects if any of the registered channels is ready for I/O operations
according to its interest set .
|
abstract
Set<SelectionKey>
|
selectedKeys()
Gets the selection keys whose channels are ready for operation.
|
abstract
Selector
|
wakeup()
Forces blocked select operations to return immediately.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
From interface
java.lang.AutoCloseable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
Protected Constructors
Public Methods
public
final
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()
.
public
final
boolean
isOpen
()
Returns true if this selector is open.
Returns
true
if this selector is not closed, false
otherwise.
Returns this selector's provider.
Returns
- the provider of this selector.
Protected Methods
protected
final
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.
protected
final
Set<SelectionKey>
cancelledKeys
()
Returns this channel's set of canceled selection keys.
Deletes the key from the channel's key set.
protected
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.
protected
abstract
void
implCloseSelector
()
Implements the closing of this channel.
Registers channel
with this selector.
Parameters
operations
| the interest set of channel . |
attachment
| the attachment for the selection key. |
Returns
- the key related to the channel and this selector.