edu.ucdavis.rj.Ops
Class Invocation

java.lang.Object
  extended by edu.ucdavis.rj.Ops.Invocation
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Invocation
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Basic invocation abstraction.

See Also:
Serialized Form

Field Summary
private  java.lang.Object[] params
          Holds the parameters of the invocation.
private  OpProxy replyOp
          Holds the reply operation for the invocation.
private  java.lang.Object returnValue
          Holds the return value for the invocation.
(package private) static long serialVersionUID
          Required by Serializable.
(package private)  Timestamp timestamp
          The timestamp for the invocation.
 
Constructor Summary
Invocation(java.lang.Object... params)
          Create an invocation with the given parameters.
 
Method Summary
protected  Invocation clone()
          Clone this Invocation.
 void forward(OpImpl fwdOpImpl)
           
 void forward(OpImpl fwdOpImpl, Invocation fwdInvocation)
           
 void forward(OpProxy fwdOpProxy)
           
 void forward(OpProxy fwdOpProxy, Invocation fwdInvocation)
          Forward an invocation to the specified operation; most importantly, the ability to reply to the original invoker is also forwarded.
 java.lang.Object getParam(int index)
          Return a parameter of the invocation.
 OpProxy getReplyOp()
          Get the reply operation for the invocation.
 java.lang.Object getReturnValue()
          Get the return value for the invocation.
(package private)  Timestamp getTimestamp()
          Get the Timestamp for the invocation.
private  void internalForward(OpProxy fwdOpProxy, Invocation originalFwdInvocation)
          Does the work for forward(edu.ucdavis.rj.Ops.OpProxy, edu.ucdavis.rj.Ops.Invocation)
private  void internalReplyToInvoker(boolean makeCopy)
          Does the work for and @Invocation#reply
 int paramsLength()
          Return the number of parameters in the invocation.
 void reply()
          Early reply for this invocation to the invoker.
 void reply(java.lang.Object value)
          //////////////// Abbreviation for this.setReplyOp(value); this.reply();
(package private)  void replyToInvoker()
          Give the invoker the reply (i.e., the go-ahead and return values) for a call invocation.
(package private)  Invocation safeClone()
          Clone this Invocation, without possibility of exceptions.
 void setReplyOp(OpProxy replyOp)
          Set the reply operation for the invocation.
 void setReturnValue(java.lang.Object value)
          Set the return value for the invocation.
(package private)  void setRJVMTimestamp()
          Update the VM's timestamp with this invocation's timestamp, which comes from a send or call (which might have originated on a different VM).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
Required by Serializable.

See Also:
Constant Field Values

params

private java.lang.Object[] params
Holds the parameters of the invocation.


returnValue

private java.lang.Object returnValue
Holds the return value for the invocation.


timestamp

Timestamp timestamp
The timestamp for the invocation. //////////////////////////// ADDDDDDDDDDDDDDD note about "precise" fairness.


replyOp

private OpProxy replyOp
Holds the reply operation for the invocation. NEEEEEEEEEEEEEEEEDDDDDDDDDDDD NOOOOOOOOOOOOOOOP. for now, test if != null................

Constructor Detail

Invocation

public Invocation(java.lang.Object... params)
Create an invocation with the given parameters.

Parameters:
params - The parameters of the invocation.
Method Detail

paramsLength

public int paramsLength()
Return the number of parameters in the invocation.

Returns:
The number of parameters in the invocation.

getParam

public java.lang.Object getParam(int index)
Return a parameter of the invocation.

Parameters:
index - Index (zero-based) of the invocation parameter to return.
Returns:
The index-th parameter. /////////// if out of range, throws IndexOutOfBoundsException

setReturnValue

public void setReturnValue(java.lang.Object value)
Set the return value for the invocation.

Parameters:
value - The return value.

getReturnValue

public java.lang.Object getReturnValue()
Get the return value for the invocation.

Returns:
The return value.

setReplyOp

public void setReplyOp(OpProxy replyOp)
Set the reply operation for the invocation.

Parameters:
replyOp - The reply operation. //////////////////////////// 2010-08-31 public for testing //////////////// deferred reply stuff

getReplyOp

public OpProxy getReplyOp()
Get the reply operation for the invocation.

Returns:
The reply operation. //////////////////////////// 2010-08-31 public for testing //////////////// deferred reply stuff

replyToInvoker

void replyToInvoker()
Give the invoker the reply (i.e., the go-ahead and return values) for a call invocation. For send invocation (or invocation to which already replied, do nothing).

Parameters:
inv - The invocation to which to reply.

internalReplyToInvoker

private void internalReplyToInvoker(boolean makeCopy)
Does the work for and @Invocation#reply

Parameters:
makeCopy - Whether to send original or copy to invoker. send original for call and send; send copy for reply.

reply

public void reply()
Early reply for this invocation to the invoker. Subsequent replies are ignored. Make copy of invocation to send back to invoker since current process will continue to use this invocation.


reply

public void reply(java.lang.Object value)
//////////////// Abbreviation for this.setReplyOp(value); this.reply();

Parameters:
value - The return value.

forward

public void forward(OpProxy fwdOpProxy,
                    Invocation fwdInvocation)
Forward an invocation to the specified operation; most importantly, the ability to reply to the original invoker is also forwarded. The invocation forwarded is either a copy of the current invocation, if no invocation is explicitly specified as a parameter, or it's the invocation specified. (Caution on forwarding the current invocation: if code has extracted parameters from the invocation into local variables and modified those variables, those changes don't appear in the invocation; create and forward a new invocation from the local variables. In either case, after forwarding, the forwarder continues to execute using the current invocation. Subsequent forwards behave like a send. A forward of an invocation that was sent also acts like a send.

Parameters:
inv - The invocation to which to reply.

forward

public void forward(OpImpl fwdOpImpl,
                    Invocation fwdInvocation)

forward

public void forward(OpProxy fwdOpProxy)

forward

public void forward(OpImpl fwdOpImpl)

internalForward

private void internalForward(OpProxy fwdOpProxy,
                             Invocation originalFwdInvocation)
Does the work for forward(edu.ucdavis.rj.Ops.OpProxy, edu.ucdavis.rj.Ops.Invocation)

Parameters:
fwdOpProxy - OpProxy to which to forward.
fwdInvocation - Invocation to which to forward.

getTimestamp

Timestamp getTimestamp()
Get the Timestamp for the invocation.

Returns:
The Timestamp.

setRJVMTimestamp

void setRJVMTimestamp()
Update the VM's timestamp with this invocation's timestamp, which comes from a send or call (which might have originated on a different VM).


clone

protected Invocation clone()
                    throws java.lang.CloneNotSupportedException
Clone this Invocation.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

safeClone

Invocation safeClone()
Clone this Invocation, without possibility of exceptions.

Returns:
The cloned Invocation.