com.oracle.coherence.patterns.command.internal
Class CommandExecutionRequest

java.lang.Object
  extended by com.oracle.coherence.patterns.command.internal.CommandExecutionRequest
All Implemented Interfaces:
com.tangosol.io.ExternalizableLite, com.tangosol.io.pof.PortableObject, Serializable, Comparable<CommandExecutionRequest>

public class CommandExecutionRequest
extends Object
implements com.tangosol.io.ExternalizableLite, com.tangosol.io.pof.PortableObject, Comparable<CommandExecutionRequest>

A CommandExecutionRequest represents a request to execute a Command with in a specified Context (by a CommandExecutor).

Along with the Command, a CommandExecutionRequest also contains meta-data about the execution request, including the globally unique Identifier of the request and the issued Ticket (by the CommandExecutor) for the purposes of ordering the Command execution on a first-come-first-served (FIFO) basis.

To have a Command executed, you should use the CommandSubmitter.submitCommand(Identifier, Command) method.

Copyright (c) 2008. All Rights Reserved. Oracle Corporation.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.

Author:
Brian Oliver
See Also:
Command, Context, CommandExecutor, Serialized Form

Nested Class Summary
static class CommandExecutionRequest.Key
          A custom key implementation for the CommandExecutionRequest class to support KeyAssociation.
static class CommandExecutionRequest.Status
          The request can be in one of three states: Pending, Started, or Canceled
 
Constructor Summary
CommandExecutionRequest()
          For ExternalizableLite and PortableObject.
CommandExecutionRequest(Identifier contextIdentifier, Command<?> command)
          Standard Constructor.
 
Method Summary
 int compareTo(CommandExecutionRequest other)
          
static String getCacheName(ContextConfiguration.ManagementStrategy managementStrategy)
          Returns the NamedCache for the CommandExecutionRequest using the specified ContextConfiguration.ManagementStrategy.
 Object getCheckpoint()
          Returns the current checkpoint for the Command.
 Command<?> getCommand()
          Returns the Command associated with the CommandExecutionRequest.
 Identifier getContextIdentifier()
          Returns the Identifier of the Context in which the CommandExecutionRequest Command will be executed.
 long getInstantQueued()
          Return the time (in milliseconds) since the EPOC when the CommandExecutionRequest was queued for execution.
 CommandExecutionRequest.Status getStatus()
          Return the current CommandExecutionRequest.Status of this request.
 Ticket getTicket()
          Returns the Ticket for the CommandExecutionRequest.
 boolean isCanceled()
          Returns if the CommandExecutionRequest has been canceled and thus should not be executed (if it hasn't already been executed or hasn't started being executed).
 void readExternal(DataInput in)
          
 void readExternal(com.tangosol.io.pof.PofReader reader)
          
 void setCheckpoint(Object checkpoint)
          Sets the current checkpoint for the Command.
 void setInstantQueued(long instantQueued)
          Sets the time (in milliseconds) since the EPOC when the CommandExecutionRequest was queued for execution.
 void setStatus(CommandExecutionRequest.Status status)
          Set the CommandExecutionRequest.Status for this request.
 void setTicket(Ticket ticket)
          Sets the Ticket for the CommandExecutionRequest.
 String toString()
          
 void writeExternal(DataOutput out)
          
 void writeExternal(com.tangosol.io.pof.PofWriter writer)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandExecutionRequest

public CommandExecutionRequest()
For ExternalizableLite and PortableObject.


CommandExecutionRequest

public CommandExecutionRequest(Identifier contextIdentifier,
                               Command<?> command)
Standard Constructor.

Parameters:
contextIdentifier -
command -
Method Detail

getContextIdentifier

public Identifier getContextIdentifier()
Returns the Identifier of the Context in which the CommandExecutionRequest Command will be executed.


getTicket

public Ticket getTicket()
Returns the Ticket for the CommandExecutionRequest. The Ticket is used to determine the order in which the CommandExecutionRequest Command will be executed in the Context.


setTicket

public void setTicket(Ticket ticket)
Sets the Ticket for the CommandExecutionRequest.

Parameters:
ticket -

getCommand

public Command<?> getCommand()
Returns the Command associated with the CommandExecutionRequest.


getInstantQueued

public long getInstantQueued()
Return the time (in milliseconds) since the EPOC when the CommandExecutionRequest was queued for execution.


setInstantQueued

public void setInstantQueued(long instantQueued)
Sets the time (in milliseconds) since the EPOC when the CommandExecutionRequest was queued for execution.


getStatus

public CommandExecutionRequest.Status getStatus()
Return the current CommandExecutionRequest.Status of this request.

Returns:
the current CommandExecutionRequest.Status of this request

setStatus

public void setStatus(CommandExecutionRequest.Status status)
Set the CommandExecutionRequest.Status for this request.

Parameters:
status - the CommandExecutionRequest.Status for this request

isCanceled

public boolean isCanceled()
Returns if the CommandExecutionRequest has been canceled and thus should not be executed (if it hasn't already been executed or hasn't started being executed).


getCheckpoint

public Object getCheckpoint()
Returns the current checkpoint for the Command.


setCheckpoint

public void setCheckpoint(Object checkpoint)
Sets the current checkpoint for the Command.

Parameters:
checkpoint -

readExternal

public void readExternal(DataInput in)
                  throws IOException

Specified by:
readExternal in interface com.tangosol.io.ExternalizableLite
Throws:
IOException

writeExternal

public void writeExternal(DataOutput out)
                   throws IOException

Specified by:
writeExternal in interface com.tangosol.io.ExternalizableLite
Throws:
IOException

readExternal

public void readExternal(com.tangosol.io.pof.PofReader reader)
                  throws IOException

Specified by:
readExternal in interface com.tangosol.io.pof.PortableObject
Throws:
IOException

writeExternal

public void writeExternal(com.tangosol.io.pof.PofWriter writer)
                   throws IOException

Specified by:
writeExternal in interface com.tangosol.io.pof.PortableObject
Throws:
IOException

compareTo

public int compareTo(CommandExecutionRequest other)

Specified by:
compareTo in interface Comparable<CommandExecutionRequest>

toString

public String toString()

Overrides:
toString in class Object

getCacheName

public static String getCacheName(ContextConfiguration.ManagementStrategy managementStrategy)
Returns the NamedCache for the CommandExecutionRequest using the specified ContextConfiguration.ManagementStrategy.

Parameters:
managementStrategy -


Copyright © 2016. All rights reserved.