Class ExecuteAction
- java.lang.Object
-
- org.simpleframework.transport.reactor.ExecuteAction
-
- All Implemented Interfaces:
java.lang.Runnable,Action
class ExecuteAction extends java.lang.Object implements Action
TheExecuteActionobject is represents an action that the distributor is to process. This contains the operation and the required I/O events as an integer bit mask as well as the selectable channel used to register for selection. In order to ensure that the action does not remain within the distributor for too long the action has an expiry time.
-
-
Field Summary
Fields Modifier and Type Field Description private longexpiryThis is the time in the future that the event will expire in.private intrequireThis is the bit mask of required operations to be executed.private OperationtaskThe task to execute when the required operations is ready.
-
Constructor Summary
Constructors Constructor Description ExecuteAction(Operation task, int require, long expiry)Constructor for theEventobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.channels.SelectableChannelgetChannel()This is theSelectableChannelwhich is used to determine if the operation should be executed.longgetExpiry()This is used to get the expiry for the operation.intgetInterest()This returns the I/O operations that the action is interested in as an integer bit mask.OperationgetOperation()This is used to acquire theOperationthat is to be executed when the required operations are ready.voidrun()This is used to execute the operation for the action.
-
-
-
Field Detail
-
task
private final Operation task
The task to execute when the required operations is ready.
-
require
private final int require
This is the bit mask of required operations to be executed.
-
expiry
private final long expiry
This is the time in the future that the event will expire in.
-
-
Constructor Detail
-
ExecuteAction
public ExecuteAction(Operation task, int require, long expiry)
Constructor for theEventobject. The actions are used to encapsulate the task to execute and the operations to listen to when some action is to be performed.- Parameters:
task- this is the task to be executed when it is readyrequire- this is the required operations to listen to
-
-
Method Detail
-
run
public void run()
This is used to execute the operation for the action. This will be executed when the interested I/O event is ready for the associatedSelectableChannelobject. If the action expires before the interested I/O operation is ready this will not be executed, instead the operation is canceled.- Specified by:
runin interfacejava.lang.Runnable
-
getExpiry
public long getExpiry()
This is used to get the expiry for the operation. The expiry represents some static time in the future when the action will expire if it does not become ready. This is used to cancel the operation so that it does not remain in the distributor.
-
getChannel
public java.nio.channels.SelectableChannel getChannel()
This is theSelectableChannelwhich is used to determine if the operation should be executed. If the channel is ready for a given I/O event it can be run. For instance if the operation is used to perform some form of read operation it can be executed when ready to read data from the channel.- Specified by:
getChannelin interfaceAction- Returns:
- this returns the channel used to govern execution
-
getOperation
public Operation getOperation()
This is used to acquire theOperationthat is to be executed when the required operations are ready. It is the responsibility of the distributor to invoke the operation.- Specified by:
getOperationin interfaceAction- Returns:
- the operation to be executed when it is ready
-
getInterest
public int getInterest()
This returns the I/O operations that the action is interested in as an integer bit mask. When any of these operations are ready the distributor will execute the provided operation.- Specified by:
getInterestin interfaceAction- Returns:
- the integer bit mask of interested I/O operations
-
-