Class ActionSet
java.lang.Object
org.simpleframework.transport.reactor.ActionSet
The
ActionSet
object represents a set of actions that
are associated with a particular selection key. Here the set
stores an Action
for each of the interested operation
types. In some situations a single action may be interested in
several operations which must be remembered by the set.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SelectionKey
This is the selection key associated with the action set.private final Action[]
This contains the the actions indexed by operation type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
This is used to attach an action to the set for a specific interest bitmask.void
cancel()
This is used to cancel theSelectionKey
associated with the action set.channel()
This provides the channel associated with the action set.void
clear()
This is used to clear all interest from the set.private Action[]
This is used to create a copy of the specified list with only the first few non null values.Action[]
get
(int interest) This is used to acquire the actions that match the bitmask of interest operations.int
interest()
This is used to acquire the operations that this is interested in.key()
This provides the selection key associated with the action set.Action[]
list()
This provides an iterator of the actions that exist within the action set.Action[]
ready()
This is sued to acquire all actions that match the currently ready operations of the key.Action[]
remove
(int interest) This is used to remove interest from the set.
-
Field Details
-
key
This is the selection key associated with the action set. -
set
This contains the the actions indexed by operation type.
-
-
Constructor Details
-
ActionSet
Constructor for theActionSet
object. This is used to create a set for storing actions keyed by operation type. Only one action is kept per operation type.- Parameters:
key
- this is the associated selection key
-
-
Method Details
-
key
This provides the selection key associated with the action set. For each ready operation on the selection key the set contains an action that can be executed.- Returns:
- this provides the selection key for this action set
-
channel
This provides the channel associated with the action set. This is the channel that is registered for selection using the interested operations for the set.- Returns:
- this returns the selectable channel for the action set
-
list
This provides an iterator of the actions that exist within the action set. Regardless of whether a single action is interested is several operations this will return an iteration of unique actions. Modifications to the iterator do not affect the set.- Returns:
- this returns an iterator of unique actions for the set
-
ready
This is sued to acquire all actions that match the currently ready operations of the key. All actions returned by this will be executed and the interest will typically be removed.- Returns:
- returns the array of ready operations for the set
-
attach
This is used to attach an action to the set for a specific interest bitmask. If the bitmask contains several operations then the action is registered for each individual operation.- Parameters:
action
- this is the action that is to be attachedinterest
- this is the interest for the action
-
remove
This is used to remove interest from the set. Removal of interest from the set is performed by registering a null for the interest operation.- Parameters:
interest
- this is the interest to be removed
-
get
This is used to acquire the actions that match the bitmask of interest operations. If there are no actions representing the interest required an empty array will be returned.- Parameters:
interest
- this is the interest to acquire actions for- Returns:
- this will return an array of actions for the interest
-
copyOf
This is used to create a copy of the specified list with only the first few non null values. This ensures we can keep the internal array immutable and still use arrays.- Parameters:
list
- this is the list that is to be copied to a new arraycount
- this is the number of entries to copy from the list- Returns:
- a copy of the original list up to the specified count
-
interest
public int interest()This is used to acquire the operations that this is interested in. If there are currently no registered actions then this will return zero. Interest is represented by non-null actions only.- Returns:
- this returns the interested operations for this
-
clear
public void clear()This is used to clear all interest from the set. This will basically clear out any actions that have been registered with the set. After invocation the iterator will be empty. -
cancel
public void cancel()This is used to cancel theSelectionKey
associated with the action set. Canceling the key in this manner ensures it is not returned in further selection operations.
-