public class SelectionRegistration
extends java.lang.Object
SelectionKey
.SelectionKey
Constructor and Description |
---|
SelectionRegistration(int interestOperations,
SelectionListener selectionListener,
org.restlet.engine.io.WakeupListener wakeupListener)
Constructor.
|
SelectionRegistration(java.nio.channels.SelectableChannel selectableChannel,
int interestOperations,
SelectionListener selectionListener,
org.restlet.engine.io.WakeupListener wakeupListener)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addInterestOperations(int interest)
Adds a given operations to the current list.
|
void |
block()
Blocks the calling thread.
|
void |
clear()
Clears the registration.
|
int |
getInterestOperations()
Returns the IO operations interest.
|
static java.lang.String |
getName(int operation)
Returns the name of the given IO operation.
|
int |
getReadyOperations()
Returns the IO operations ready.
|
java.nio.channels.SelectableChannel |
getSelectableChannel()
Returns the parent selectable channel.
|
SelectionListener |
getSelectionListener()
Returns the selection listener that will be notified.
|
org.restlet.engine.io.WakeupListener |
getWakeupListener()
Returns the wakeup listener that will be notified.
|
boolean |
isCanceling()
Indicates if a canceling of the registration has been requested.
|
boolean |
isConnectable()
Indicates if the NIO channel is connectable.
|
boolean |
isInterestReady()
Indicates if the operations of interest are ready.
|
boolean |
isReadable()
Indicates if the NIO channel is readable.
|
boolean |
isWritable()
Indicates if the NIO channel is writable.
|
void |
onSelected(int readyOperations)
Called back with some interest operations are ready.
|
java.nio.channels.SelectionKey |
register(java.nio.channels.Selector selector)
Effectively registers the
getSelectableChannel() with the given
Selector for the getInterestOperations() operations. |
void |
resume()
Resume interest in new listener notifications.
|
void |
setCanceling(boolean canceling)
Sets interest in canceling the registration.
|
boolean |
setInterestOperations(int interest)
Sets the IO operations interest.
|
void |
setNoInterest()
Sets interest in no IO operations.
|
void |
setReadInterest()
Sets interest in IO read operations.
|
void |
setReadyOperations(int readyOperations)
Sets the IO operations ready.
|
void |
setSelectionListener(SelectionListener listener)
Sets the selection listener that will be notified.
|
void |
setWakeupListener(org.restlet.engine.io.WakeupListener wakeupListener)
Sets the wakeup listener that will be notified.
|
void |
setWriteInterest()
Sets interest in IO read operations.
|
void |
suspend()
Suspend interest in new listener notifications.
|
java.lang.String |
toString() |
void |
unblock()
Unblocks the optionally blocked thread.
|
java.nio.channels.SelectionKey |
update()
Effectively updates the registration of the
getSelectableChannel() with the given Selector for the
getInterestOperations() operations. |
public SelectionRegistration(int interestOperations, SelectionListener selectionListener, org.restlet.engine.io.WakeupListener wakeupListener)
interestOperations
- The IO operations interest.selectionListener
- The selection listener that will be notified.wakeupListener
- The wakeup listener that will be notified.public SelectionRegistration(java.nio.channels.SelectableChannel selectableChannel, int interestOperations, SelectionListener selectionListener, org.restlet.engine.io.WakeupListener wakeupListener)
selectableChannel
- The parent selectable channel.interestOperations
- The IO operations interest.selectionListener
- The selection listener that will be notified.wakeupListener
- The wakeup listener that will be notified.public static java.lang.String getName(int operation)
operation
- The IO operation code.public void addInterestOperations(int interest)
interest
- public void block() throws java.io.IOException
java.io.IOException
block()
public void clear()
public int getInterestOperations()
public int getReadyOperations()
public java.nio.channels.SelectableChannel getSelectableChannel()
public SelectionListener getSelectionListener()
public org.restlet.engine.io.WakeupListener getWakeupListener()
public boolean isCanceling()
public boolean isConnectable()
public boolean isInterestReady()
public boolean isReadable()
public boolean isWritable()
public void onSelected(int readyOperations) throws java.io.IOException
getSelectionListener()
.readyOperations
- The ready operations.java.io.IOException
public java.nio.channels.SelectionKey register(java.nio.channels.Selector selector)
getSelectableChannel()
with the given
Selector
for the getInterestOperations()
operations.selector
- The NIO selector to register to.public void resume()
suspend()
call.public void setCanceling(boolean canceling)
canceling
- True if a canceling request is made.public boolean setInterestOperations(int interest)
interest
- The IO operations interest.public void setNoInterest()
public void setReadInterest()
public void setReadyOperations(int readyOperations)
readyOperations
- The IO operations ready.public void setSelectionListener(SelectionListener listener)
listener
- The selection listener that will be notified.public void setWakeupListener(org.restlet.engine.io.WakeupListener wakeupListener)
wakeupListener
- The wakeup listener that will be notified.public void setWriteInterest()
public void suspend()
setInterestOperations(int)
with a 0
value.public java.lang.String toString()
toString
in class java.lang.Object
public void unblock() throws java.io.IOException
java.io.IOException
block()
public java.nio.channels.SelectionKey update()
getSelectableChannel()
with the given Selector
for the
getInterestOperations()
operations.Copyright © 2005-2024 Restlet.