com.oracle.coherence.patterns.command
Interface ExecutionEnvironment<C extends Context>


public interface ExecutionEnvironment<C extends Context>

An ExecutionEnvironment is provided to a Command when it is being executed. The ExecutionEnvironment is used to provide the "environment" for the Command, including;

  1. The Context in which the execution is taking place
  2. An Identifier that uniquely represents the specific execution request. This may be used to assist in ensuring idempotent Command execution when an execution is recovering.
  3. A Ticket to determine the order in which the specific Command execution is taking place.
  4. A flag to determine if the execution is being recovered.

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

Author:
Brian Oliver

Method Summary
 C getContext()
          Returns the Context in which an execution is taking place.
 ContextConfiguration getContextConfiguration()
          Returns the ContextConfiguration for the Context in which the execution is taking place.
 Identifier getContextIdentifier()
          Returns the Identifier of the Context in which the execution is taking place.
 Ticket getTicket()
          Returns the unique Ticket (within the scope of the Context) issued to the execution taking place with this ExecutionEnvironment.
 boolean hasCheckpoint()
          Determine if state has been previously saved (called a "checkpoint") for the currently executing Command.
 boolean isRecovering()
          Returns if the ExecutionEnvironment is recovering due to either a Coherence Cluster Recovery or Repartitioning event.
 Object loadCheckpoint()
          Load the previously saved "checkpoint" state for the currently executing Command that was stored using saveCheckpoint(Object).
 void removeCheckpoint()
          Immediately removes any previously saved "checkpoint" state for the currently executing Command.
 void saveCheckpoint(Object state)
          Immediately save the specified state as a "checkpoint" during the execution of a Command so that it may later be retrieved (via loadCheckpoint()).
 void setContext(C context)
          Use this method to update the Context (as necessary) during the execution of a Command.
 

Method Detail

getContextIdentifier

Identifier getContextIdentifier()
Returns the Identifier of the Context in which the execution is taking place.


getContext

C getContext()
Returns the Context in which an execution is taking place.


setContext

void setContext(C context)
Use this method to update the Context (as necessary) during the execution of a Command.

Parameters:
context -
Throws:
IllegalStateException - If the context value provided is null

getContextConfiguration

ContextConfiguration getContextConfiguration()
Returns the ContextConfiguration for the Context in which the execution is taking place.


getTicket

Ticket getTicket()
Returns the unique Ticket (within the scope of the Context) issued to the execution taking place with this ExecutionEnvironment.

This Ticket may be used to order and compare previous executions against the same Context.


isRecovering

boolean isRecovering()
Returns if the ExecutionEnvironment is recovering due to either a Coherence Cluster Recovery or Repartitioning event.


hasCheckpoint

boolean hasCheckpoint()
Determine if state has been previously saved (called a "checkpoint") for the currently executing Command.


saveCheckpoint

void saveCheckpoint(Object state)
Immediately save the specified state as a "checkpoint" during the execution of a Command so that it may later be retrieved (via loadCheckpoint()).

Using "checkpoints" can simplify the recovery of previous attempts at executing a Command.

NOTE: The state must be serializable in some manner, ie: with Serializable, Externalizable, ExternalizableLite and/or PortableObject.

Parameters:
state -

loadCheckpoint

Object loadCheckpoint()
Load the previously saved "checkpoint" state for the currently executing Command that was stored using saveCheckpoint(Object).

Returns:
null if there is no previously saved "checkpoint" state.

removeCheckpoint

void removeCheckpoint()
Immediately removes any previously saved "checkpoint" state for the currently executing Command. NOTE: This is functionally equivalent to saveCheckpoint(Object) with null.



Copyright © 2016. All rights reserved.