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

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

public class ContextWrapper
extends Object
implements com.tangosol.io.ExternalizableLite, com.tangosol.io.pof.PortableObject

A ContextWrapper is used to wrap and provide internal execution information about an individual Context, including how to identify the Context, the cluster member on which the Context was originally created and the Ticket of the last successfully executed Command (so we can know where to recover from in case of fail-over, load-balancing or restart.

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:
Serialized Form

Field Summary
static String CACHENAME
          The Coherence cache in which ContextWrappers will be placed.
 
Constructor Summary
ContextWrapper()
          Required for ExternalizableLite.
ContextWrapper(Identifier contextIdentifier, Context context, ContextConfiguration contextConfiguration)
          Standard Constructor.
 
Method Summary
 Identifier getContentIdentifier()
          Returns the unique Identifier that is used to represent the Context.
 Context getContext()
          Return the Context being wrapped (ie: managed).
 ContextConfiguration getContextConfiguration()
          Returns the ContextConfiguration for the Context being wrapped.
 long getContextVersion()
          Return the current version number of the ContextWrapper.
 Ticket getLastExecutedTicket()
          Returns the Ticket of the last successfully executed Command for the Context.
 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 that have been executed for the Context.
 long nextVersion()
          Increments, stores and returns the next version of the Context.
 void readExternal(DataInput in)
          
 void readExternal(com.tangosol.io.pof.PofReader reader)
          
 void setContext(Context context)
          Replace the Context being wrapped (ie: managed).
 String toString()
          
 void updateExecutionInformation(Ticket ticket, long executionDuration, long waitingDuration)
          Updates the execution information for the Context tracked by the ContextWrapper after a Command has been executed.
 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
 

Field Detail

CACHENAME

public static final String CACHENAME
The Coherence cache in which ContextWrappers will be placed.

See Also:
Constant Field Values
Constructor Detail

ContextWrapper

public ContextWrapper()
Required for ExternalizableLite.


ContextWrapper

public ContextWrapper(Identifier contextIdentifier,
                      Context context,
                      ContextConfiguration contextConfiguration)
Standard Constructor. Used by the DefaultContextsManager class when creating Contexts.

Parameters:
contextIdentifier -
context -
Method Detail

getContentIdentifier

public Identifier getContentIdentifier()
Returns the unique Identifier that is used to represent the Context.


getContext

public Context getContext()
Return the Context being wrapped (ie: managed).


setContext

public void setContext(Context context)
Replace the Context being wrapped (ie: managed).


getContextConfiguration

public ContextConfiguration getContextConfiguration()
Returns the ContextConfiguration for the Context being wrapped.


getContextVersion

public long getContextVersion()
Return the current version number of the ContextWrapper.


nextVersion

public long nextVersion()
Increments, stores and returns the next version of the Context.


getLastExecutedTicket

public Ticket getLastExecutedTicket()
Returns the Ticket of the last successfully executed Command for the Context.


getTotalCommandsExecuted

public long getTotalCommandsExecuted()
Returns the total number of Commands that have been executed for the Context.


getTotalCommandExecutionDuration

public long getTotalCommandExecutionDuration()
Returns the total time (in milliseconds) that the Commands executed thus far have taken to execute.


getTotalCommandExecutionWaitingDuration

public long getTotalCommandExecutionWaitingDuration()
Returns the total time (in milliseconds) that the Commands executed thus far have waited to execute (ie: the queuing time).


updateExecutionInformation

public void updateExecutionInformation(Ticket ticket,
                                       long executionDuration,
                                       long waitingDuration)
Updates the execution information for the Context tracked by the ContextWrapper after a Command has been executed.

Parameters:
ticket -
executionDuration -
waitingDuration -

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

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2016. All rights reserved.