org.objectweb.proactive.core.mop
Class MethodCall

java.lang.Object
  |
  +--org.objectweb.proactive.core.mop.MethodCall
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
MethodCallControlForGroup

public class MethodCall
extends java.lang.Object
implements java.io.Serializable

Instances of this class represent method calls performed on reified objects. They are generated by a stub object, whose role is to act as a representative for the reified object.

Author:
Julien Vayssière
See Also:
Serialized Form

Nested Class Summary
 class MethodCall.FixWrapper
           
 
Field Summary
static java.lang.String COMPONENT_TAG
           
 
Constructor Summary
protected MethodCall()
          Builds a new MethodCall object.
  MethodCall(MethodCall mc)
          Builds a new MethodCall object.
  MethodCall(java.lang.reflect.Method reifiedMethod, java.lang.Object[] effectiveArguments)
          Builds a new MethodCall object.
 
Method Summary
 java.lang.Object execute(java.lang.Object targetObject)
          Executes the instance method call represented by this object.
protected  void finalize()
           
static MethodCall getComponentMethodCall(java.lang.reflect.Method reifiedMethod, java.lang.Object[] effectiveArguments, java.lang.String fcFunctionalInterfaceName)
          Returns a MethodCall object with extra info for component calls (the possible name of the functional interface invoked).
 java.lang.String getFcFunctionalInterfaceName()
          accessor for the functional name ot the invoked Fractal interface
static MethodCall getMethodCall(java.lang.reflect.Method reifiedMethod, java.lang.Object[] effectiveArguments)
          Factory method for getting MethodCall objects
 java.lang.String getName()
          Returns the name of the method
 int getNumberOfParameter()
           
 java.lang.Object getParameter(int index)
           
static boolean getRecycleMethodCallObject()
          Indicates if the recycling of MethodCall objects is currently running or not.
 java.lang.reflect.Method getReifiedMethod()
           
 java.lang.String getTag()
          accessor for the tag of the method call
 boolean isAsynchronousWayCall()
          Checks if the Call object can be processed with a future semantics, i-e if its returned object can be a future object.
 boolean isOneWayCall()
          Returns a boolean saying whether the method is one-way or not.
 void makeDeepCopyOfArguments()
          Make a deep copy of all arguments of the constructor
protected  void readTheObject(java.io.ObjectInputStream in)
           
 void setEffectiveArguments(java.lang.Object[] o)
           
 void setFcFunctionalInterfaceName(java.lang.String string)
          setter for the functional name of the invoked Fractal interface
static void setMethodCall(MethodCall mc)
          Tells the recyclying process that the MethodCall object passed as parameter is ready for recycling.
static void setRecycleMethodCallObject(boolean value)
          Sets recycling of MethodCall objects on/off.
 void setTag(java.lang.String string)
          setter for the tag of the method call
 void transformEffectiveArgumentsIntoByteArray()
          transform the effectiveArguments into a byte[]
protected  void writeTheObject(java.io.ObjectOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_TAG

public static final java.lang.String COMPONENT_TAG
See Also:
Constant Field Values
Constructor Detail

MethodCall

public MethodCall(java.lang.reflect.Method reifiedMethod,
                  java.lang.Object[] effectiveArguments)
Builds a new MethodCall object. Please, consider use the factory method getMethodCall instead of build a new MethodCall object.


MethodCall

public MethodCall(MethodCall mc)
Builds a new MethodCall object. This constructor is a copy constructor. Fields of the object are also copied. Please, consider use the factory method getMethodCall instead of build a new MethodCall object.

Parameters:
mc - - the MethodCall object to copy

MethodCall

protected MethodCall()
Builds a new MethodCall object.

Method Detail

transformEffectiveArgumentsIntoByteArray

public void transformEffectiveArgumentsIntoByteArray()
transform the effectiveArguments into a byte[]


setRecycleMethodCallObject

public static void setRecycleMethodCallObject(boolean value)
Sets recycling of MethodCall objects on/off. Note that turning the recycling off and on again results in the recycling pool being flushed, thus damaging performances.

Parameters:
value - sets the recycling on if true, otherwise turns it off.

getRecycleMethodCallObject

public static boolean getRecycleMethodCallObject()
Indicates if the recycling of MethodCall objects is currently running or not.

Returns:
true if recycling is on, false otherwise

getMethodCall

public static MethodCall getMethodCall(java.lang.reflect.Method reifiedMethod,
                                       java.lang.Object[] effectiveArguments)
Factory method for getting MethodCall objects

Parameters:
reifiedMethod - a Method object that represents the method whose invocation is reified
effectiveArguments - the effective arguments of the call. Arguments that are of primitive type need to be wrapped within an instance of the corresponding wrapper class (like java.lang.Integer for primitive type int for example).
Returns:
a MethodCall object representing an invocation of method reifiedMethod with arguments effectiveArguments

getComponentMethodCall

public static MethodCall getComponentMethodCall(java.lang.reflect.Method reifiedMethod,
                                                java.lang.Object[] effectiveArguments,
                                                java.lang.String fcFunctionalInterfaceName)
Returns a MethodCall object with extra info for component calls (the possible name of the functional interface invoked).

Parameters:
reifiedMethod -
effectiveArguments -
fcFunctionalInterfaceName - fractal interface name, whose value is : - null if the call is non-functional - the name of the functional interface otherwise
Returns:
MethodCall

setMethodCall

public static void setMethodCall(MethodCall mc)
Tells the recyclying process that the MethodCall object passed as parameter is ready for recycling. It is the responsibility of the caller of this method to make sure that this object can safely be disposed of.


execute

public java.lang.Object execute(java.lang.Object targetObject)
                         throws java.lang.reflect.InvocationTargetException,
                                MethodCallExecutionFailedException
Executes the instance method call represented by this object.

Parameters:
targetObject - the Object the method is called on
Returns:
the result of the invocation of the method. If the method returns void, then null is returned. If the method returned a primitive type, then it is wrapped inside the appropriate wrapper object.
Throws:
MethodCallExecutionFailedException - thrown if the refleciton of the call failed.
java.lang.reflect.InvocationTargetException - thrown if the execution of the reified method terminates abruptly by throwing an exception. The exception thrown by the execution of the reified method is placed inside the InvocationTargetException object.

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

getReifiedMethod

public java.lang.reflect.Method getReifiedMethod()

getName

public java.lang.String getName()
Returns the name of the method

Returns:
the name of the method

getNumberOfParameter

public int getNumberOfParameter()

getParameter

public java.lang.Object getParameter(int index)

setEffectiveArguments

public void setEffectiveArguments(java.lang.Object[] o)

makeDeepCopyOfArguments

public void makeDeepCopyOfArguments()
                             throws java.io.IOException
Make a deep copy of all arguments of the constructor

java.io.IOException

getFcFunctionalInterfaceName

public java.lang.String getFcFunctionalInterfaceName()
accessor for the functional name ot the invoked Fractal interface

Returns:
the functional name of the invoked Fractal interface

setFcFunctionalInterfaceName

public void setFcFunctionalInterfaceName(java.lang.String string)
setter for the functional name of the invoked Fractal interface


setTag

public void setTag(java.lang.String string)
setter for the tag of the method call


getTag

public java.lang.String getTag()
accessor for the tag of the method call

Returns:
the tag of the method call

writeTheObject

protected void writeTheObject(java.io.ObjectOutputStream out)
                       throws java.io.IOException
java.io.IOException

readTheObject

protected void readTheObject(java.io.ObjectInputStream in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

isOneWayCall

public boolean isOneWayCall()
Returns a boolean saying whether the method is one-way or not. Being one-way method is equivalent to

Returns:
true if and only if the method call is one way

isAsynchronousWayCall

public boolean isAsynchronousWayCall()
Checks if the Call object can be processed with a future semantics, i-e if its returned object can be a future object. Two conditions must be met :

Returns:
true if and only if the method call is asynchronous


Copyright © April 2004 INRIA All Rights Reserved.