Class ExecuteAction

java.lang.Object
org.simpleframework.transport.reactor.ExecuteAction
All Implemented Interfaces:
Runnable, Action

class ExecuteAction extends Object implements Action
The ExecuteAction object 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 final long
    This is the time in the future that the event will expire in.
    private final int
    This is the bit mask of required operations to be executed.
    private final Operation
    The task to execute when the required operations is ready.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExecuteAction(Operation task, int require, long expiry)
    Constructor for the Event object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This is the SelectableChannel which is used to determine if the operation should be executed.
    long
    This is used to get the expiry for the operation.
    int
    This returns the I/O operations that the action is interested in as an integer bit mask.
    This is used to acquire the Operation that is to be executed when the required operations are ready.
    void
    run()
    This is used to execute the operation for the action.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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 Details

    • ExecuteAction

      public ExecuteAction(Operation task, int require, long expiry)
      Constructor for the Event object. 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 ready
      require - this is the required operations to listen to
  • Method Details

    • 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 associated SelectableChannel object. If the action expires before the interested I/O operation is ready this will not be executed, instead the operation is canceled.
      Specified by:
      run in interface 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.
      Specified by:
      getExpiry in interface Action
      Returns:
      the remaining time this operation will wait for
    • getChannel

      public SelectableChannel getChannel()
      This is the SelectableChannel which 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:
      getChannel in interface Action
      Returns:
      this returns the channel used to govern execution
    • getOperation

      public Operation getOperation()
      This is used to acquire the Operation that is to be executed when the required operations are ready. It is the responsibility of the distributor to invoke the operation.
      Specified by:
      getOperation in interface Action
      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:
      getInterest in interface Action
      Returns:
      the integer bit mask of interested I/O operations