|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.oracle.coherence.patterns.command.internal.CommandExecutor
public class CommandExecutor
An CommandExecutor is responsible for coordinating and
executing Commands (represented as CommandExecutionRequests)
for a single Context.
Included in this responsibility is the recovery and potential
re-execution of CommandExecutionRequests
(in-the-originally-submitted-order). Such recovery may be due
to Coherence load-balancing or recovering cache partitions.
Internally CommandExecutors operate as a FiniteStateMachine
(see CommandExecutor.State for details on states).
CommandExecutors state transitions are driven by 'events'
raised by the ContextBackingMapListener or through requests made by
the SubmitCommandExecutionRequestProcessor.
All CommandExecutors are monitorable through JMX. They are
automatically registered and de-registered when they created and stopped
(respectively).
Copyright (c) 2008-2016. All Rights Reserved. Oracle Corporation.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
CommandExecutionRequest,
CommandSubmitter,
CommandExecutorMBean,
SubmitCommandExecutionRequestProcessor| Nested Class Summary | |
|---|---|
static class |
CommandExecutor.CommandExecutorEvent
The types of events the CommandExecutor
FiniteStateMachine will accept. |
static class |
CommandExecutor.State
The set of possible CommandExecutor.States for a CommandExecutor. |
| Constructor Summary | |
|---|---|
CommandExecutor(Identifier ctxIdentifier,
com.tangosol.net.PartitionedService svcPartition,
ScheduledExecutorService executorService)
Internal Constructor. |
|
| Method Summary | |
|---|---|
SubmissionOutcome |
acceptCommandExecutionRequest(CommandExecutionRequest commandExecutionRequest,
com.tangosol.net.BackingMapManagerContext ctxBackingMapManagerContext)
Accepts the specified CommandExecutionRequest for execution by this CommandExecutor. |
Identifier |
getContextIdentifier()
Returns the Identifier of the Context for which
this CommandExecutor is coordinating CommandExecutionRequest execution. |
String |
getContextIdentity()
Returns the Context Identifier as a string. |
long |
getContextVersion()
Returns the version number of the Context that the CommandExecutor
is managing. |
double |
getLocalAverageCommandExecutionDuration()
Returns the average execution time (in milliseconds) for the Commands executed locally by the current owner of the Context
(ie: local CommandExecutor). |
double |
getLocalCommandExecutionServiceDuration()
Returns the local command execution service duration (in milliseconds). |
long |
getLocalCommandsExecuted()
Returns the number of Commands that have been executed locally by the
current owner of the Context (ie: local CommandExecutor). |
long |
getLocalCommandsSubmitted()
Returns the number of Commands that have been submitted locally to the
current owner of the Context (ie: local CommandExecutor). |
double |
getLocalLastCommandExecutionDuration()
Returns the execution time (in milliseconds) for the last Command executed
locally by the current owner of the Context (ie: the local CommandExecutor) |
double |
getLocalMaximumCommandExecutionDuration()
Returns the maximum time (in milliseconds) that a Command has taken
to execute locally by the current owner of the Context (ie: the local CommandExecutor) |
double |
getLocalMinimumCommandExecutionDuration()
Returns the minimum time (in milliseconds) that a Command has taken
to execute locally by the current owner of the Context (ie: the local CommandExecutor) |
String |
getMBeanName()
Returns the cluster-wide uniquely generated JMX bean name for the CommandExecutor. |
CommandExecutor.State |
getState()
Obtains the current CommandExecutor.State of the CommandExecutor. |
String |
getStatus()
Returns the current CommandExecutor.State of the CommandExecutor. |
long |
getTicketIssuerId()
Returns the current id that is being used to issue Tickets. |
long |
getTotalCommandExecutionDuration()
Returns the total time (in milliseconds) that the Commands executed thus far have taken to execute. |
long |
getTotalCommandExecutionWaitingDuration()
Returns the total time (in milliseconds) that the Commands executed thus far have waited to execute (ie: the queuing time). |
long |
getTotalCommandsExecuted()
Returns the total number of Commands for the Context
that have been executed (regardless of the owner) |
long |
getTotalCommandsPendingExecution()
Returns the total number of Commands that are yet to be executed |
Instruction |
onDelaying(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
Handles when the CommandExecutor has to delay execution of
CommandExecutionRequests due to doubt of context ownership |
Instruction |
onExecuting(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
Executes one or more CommandExecutionRequests that are
currently waiting to be executed for the command context. |
Instruction |
onScheduled(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
Handles when the CommandExecutor schedules to execute
CommandExecutionRequests. |
Instruction |
onStarting(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
Starts ups, initializes, recovers and schedules the CommandExecutor
to start processing CommandExecutionRequests. |
Instruction |
onStopping(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
Handles the shutdown/stopping process, afterwhich no further requests will be processed. |
void |
start()
Starts up, initializes, recovers and schedules the CommandExecutor
to start processing CommandExecutionRequests. |
void |
stop()
Immediately stops the CommandExecutor from executing
any further CommandExecutionRequests. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CommandExecutor(Identifier ctxIdentifier,
com.tangosol.net.PartitionedService svcPartition,
ScheduledExecutorService executorService)
CommandExecutor for your application,
you should use a ContextsManager.
ctxIdentifier - | Method Detail |
|---|
public Identifier getContextIdentifier()
Identifier of the Context for which
this CommandExecutor is coordinating CommandExecutionRequest execution.
Context Identifiers are unique across a cluster.
public CommandExecutor.State getState()
CommandExecutor.State of the CommandExecutor.
public String getMBeanName()
CommandExecutor.
public String getContextIdentity()
CommandExecutorMBeanContext Identifier as a string.
getContextIdentity in interface CommandExecutorMBeanpublic long getContextVersion()
CommandExecutorMBeanContext that the CommandExecutor
is managing.
getContextVersion in interface CommandExecutorMBeanpublic String getStatus()
CommandExecutorMBeanCommandExecutor.State of the CommandExecutor.
getStatus in interface CommandExecutorMBeanpublic long getTicketIssuerId()
CommandExecutorMBeanTickets.
NOTE: If another CommandExecutor is created for same
Context with the same Identifier in the cluster (due
to recovery / load-balancing of Contexts), a new Ticket
issuer id will be allocated to the new CommandExecutor.
This ensures that for each instance of a CommandExecutor, the
Ticket issuer id will be different, thus allowing us to "order"
Commands send to particular CommandExecutors.
getTicketIssuerId in interface CommandExecutorMBeanpublic long getTotalCommandsPendingExecution()
CommandExecutorMBeanCommands that are yet to be executed
getTotalCommandsPendingExecution in interface CommandExecutorMBeanpublic long getLocalCommandsSubmitted()
CommandExecutorMBeanCommands that have been submitted locally to the
current owner of the Context (ie: local CommandExecutor).
getLocalCommandsSubmitted in interface CommandExecutorMBeanpublic long getLocalCommandsExecuted()
CommandExecutorMBeanCommands that have been executed locally by the
current owner of the Context (ie: local CommandExecutor).
getLocalCommandsExecuted in interface CommandExecutorMBeanpublic double getLocalAverageCommandExecutionDuration()
CommandExecutorMBeanCommands executed locally by the current owner of the Context
(ie: local CommandExecutor).
getLocalAverageCommandExecutionDuration in interface CommandExecutorMBeanpublic double getLocalLastCommandExecutionDuration()
CommandExecutorMBeanCommand executed
locally by the current owner of the Context (ie: the local CommandExecutor)
getLocalLastCommandExecutionDuration in interface CommandExecutorMBeanpublic double getLocalCommandExecutionServiceDuration()
CommandExecutorMBean
getLocalCommandExecutionServiceDuration in interface CommandExecutorMBeanpublic double getLocalMinimumCommandExecutionDuration()
CommandExecutorMBeanCommand has taken
to execute locally by the current owner of the Context (ie: the local CommandExecutor)
getLocalMinimumCommandExecutionDuration in interface CommandExecutorMBeanpublic double getLocalMaximumCommandExecutionDuration()
CommandExecutorMBeanCommand has taken
to execute locally by the current owner of the Context (ie: the local CommandExecutor)
getLocalMaximumCommandExecutionDuration in interface CommandExecutorMBeanpublic long getTotalCommandsExecuted()
CommandExecutorMBeanCommands for the Context
that have been executed (regardless of the owner)
getTotalCommandsExecuted in interface CommandExecutorMBeanpublic long getTotalCommandExecutionDuration()
CommandExecutorMBeanCommands executed thus far have taken to execute.
getTotalCommandExecutionDuration in interface CommandExecutorMBeanpublic long getTotalCommandExecutionWaitingDuration()
CommandExecutorMBeanCommands executed thus far have waited to execute (ie: the queuing time).
getTotalCommandExecutionWaitingDuration in interface CommandExecutorMBean
public Instruction onStarting(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
CommandExecutor
to start processing CommandExecutionRequests.
previousState - the previous CommandExecutor.StatenewState - the new CommandExecutor.State
Instruction to perform once the CommandExecutor
is started.public void start()
CommandExecutor
to start processing CommandExecutionRequests.
public Instruction onScheduled(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
CommandExecutor schedules to execute
CommandExecutionRequests.
previousState - the previous CommandExecutor.StatenewState - the new CommandExecutor.State
Instruction to perform once the CommandExecutor
is started.
public Instruction onDelaying(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
CommandExecutor has to delay execution of
CommandExecutionRequests due to doubt of context ownership
previousState - the previous CommandExecutor.StatenewState - the new CommandExecutor.State
Instruction to perform once the CommandExecutor
is started.
public Instruction onStopping(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
previousState - the previous CommandExecutor.StatenewState - the new CommandExecutor.State
Instruction to perform once the CommandExecutor
is started.public void stop()
CommandExecutor from executing
any further CommandExecutionRequests.
public SubmissionOutcome acceptCommandExecutionRequest(CommandExecutionRequest commandExecutionRequest,
com.tangosol.net.BackingMapManagerContext ctxBackingMapManagerContext)
CommandExecutionRequest for execution by this CommandExecutor.
As part of this process, the CommandExecutionRequest is issued with a Ticket, has
the instant in time the CommandExecutionRequest was accepted (queued), places the
CommandExecutionRequest into the CommandExecutionRequests cache and queues
the CommandExecutionRequest for execution.
If the Member in which this CommandExecutor is running no longer owns the Context
to which the CommandExecutionRequest has been submitted (or ownership is in doubt), a Ticket.NONE
is returned.
commandExecutionRequest - The CommandExecutionRequest to be accepted
public Instruction onExecuting(CommandExecutor.State previousState,
CommandExecutor.State newState,
Event event,
ExecutionContext context)
CommandExecutionRequests that are
currently waiting to be executed for the command context.
previousState - the previous CommandExecutor.StatenewState - the new CommandExecutor.State
Instruction to perform once the CommandExecutor
is started.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||