|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jppf.server.nio.StateTransitionManager<S,T>
S - type safe enum of the possible states for a channel.T - type safe enum of the possible state transitions for a channel.public class StateTransitionManager<S extends Enum<S>,T extends Enum<T>>
Instances of this class manage the state transitions of channels opened via a NioServer.
| Nested Class Summary | |
|---|---|
static class |
StateTransitionManager.ChannelRegistrationAction
Abstract super class for an action to perform upon registration of a channel. |
| Field Summary | |
|---|---|
protected ExecutorService |
executor
The pool of threads used for submitting channel state transitions. |
| Constructor Summary | |
|---|---|
StateTransitionManager(NioServer<S,T> server,
boolean sequential)
Initialize this transition manager with the specified server and sequential flag. |
|
| Method Summary | |
|---|---|
boolean |
isSequential()
Determine whether the submission of state transitions should be performed sequentially. |
ChannelWrapper<?> |
registerChannel(SocketChannel channel,
int ops,
NioContext context,
StateTransitionManager.ChannelRegistrationAction action)
Register a channel not opened through this server. |
void |
submit(Runnable r)
Submit the specified task for execution. |
void |
submitTransition(ChannelWrapper<?> key)
Submit the next state transition for a specified channel. |
void |
transitionChannel(ChannelWrapper<?> channel,
T transition)
Transition the specified channel to the specified state. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ExecutorService executor
| Constructor Detail |
|---|
public StateTransitionManager(NioServer<S,T> server,
boolean sequential)
server - the server for which this transition manager is intended.sequential - determines whether the submission of state transitions should be
performed sequentially or through the executor thread pool.| Method Detail |
|---|
public void submitTransition(ChannelWrapper<?> key)
key - the selection key that references the channel.
public void transitionChannel(ChannelWrapper<?> channel,
T transition)
channel - the key holding the channel and associated context.transition - holds the new state of the channel and associated key ops.
public ChannelWrapper<?> registerChannel(SocketChannel channel,
int ops,
NioContext context,
StateTransitionManager.ChannelRegistrationAction action)
channel - the channel to register.ops - the operations the channel is initially interested in.context - the context attached to the channel.action - an action to perform upon registration of the channel.
ChannelWrapper instance.public void submit(Runnable r)
r - the task to run.public boolean isSequential()
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||