org.objectweb.proactive.core.mop
Class MethodCall

java.lang.Object
  extended byorg.objectweb.proactive.core.mop.MethodCall
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
MethodCallControlForGroup

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

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
protected static org.apache.log4j.Logger componentLogger
           
protected  short priority
           
protected  Shortcut shortcut
           
 
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)
           
  MethodCall(java.lang.reflect.Method reifiedMethod, java.lang.Object[] effectiveArguments, MethodCallMetadata metadata)
          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()
           
 java.util.LinkedList getBarrierTags()
          Get the tags for barrier to the method call (by copy)
 java.lang.String getComponentInterfaceName()
          accessor for the name ot the invoked Fractal interface
static MethodCall getComponentMethodCall(java.lang.reflect.Method reifiedMethod, java.lang.Object[] effectiveArguments, java.lang.String interfaceName, boolean isFunctional)
           
static MethodCall getComponentMethodCall(java.lang.reflect.Method reifiedMethod, java.lang.Object[] effectiveArguments, java.lang.String interfaceName, boolean isFunctional, short priority)
          Returns a MethodCall object with extra info for component calls (the possible name of the functional interface invoked).
 MethodCallMetadata getMetadata()
           
static MethodCall getMethodCall(java.lang.reflect.Method reifiedMethod, java.lang.Object[] effectiveArguments)
           
static MethodCall getMethodCall(java.lang.reflect.Method reifiedMethod, java.lang.Object[] effectiveArguments, MethodCallMetadata metadata)
          Factory method for getting MethodCall objects
 java.lang.String getName()
          Returns the name of the method
 int getNumberOfParameter()
           
 java.lang.Object getParameter(int index)
           
 java.lang.Object[] getParameters()
           
 short getPriority()
           
static boolean getRecycleMethodCallObject()
          Indicates if the recycling of MethodCall objects is currently running or not.
 java.lang.reflect.Method getReifiedMethod()
           
 Shortcut getShortcut()
           
 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 isComponentControllerMethodCall()
           
 boolean isComponentMethodCall()
           
 boolean isComponentMethodCallOnComponent()
           
 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 setBarrierTags(java.util.LinkedList barrierTags)
          Set the tags for barrier to the method call (by copy)
 void setComponentInterfaceName(java.lang.String string)
          setter for the functional name of the invoked Fractal interface
 void setEffectiveArguments(java.lang.Object[] o)
           
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 shortcutNotification(UniversalBody sender, UniversalBody intermediate)
           
 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

componentLogger

protected static org.apache.log4j.Logger componentLogger

shortcut

protected Shortcut shortcut

priority

protected short priority
Constructor Detail

MethodCall

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


MethodCall

public MethodCall(java.lang.reflect.Method reifiedMethod,
                  java.lang.Object[] effectiveArguments)

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,
                                       MethodCallMetadata metadata)
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

getMethodCall

public static MethodCall getMethodCall(java.lang.reflect.Method reifiedMethod,
                                       java.lang.Object[] effectiveArguments)

getComponentMethodCall

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

Parameters:
reifiedMethod -
effectiveArguments -
interfaceName - fractal interface name
priority - default is to 3 (strict FIFO)
Returns:
MethodCall

getComponentMethodCall

public static MethodCall getComponentMethodCall(java.lang.reflect.Method reifiedMethod,
                                                java.lang.Object[] effectiveArguments,
                                                java.lang.String interfaceName,
                                                boolean isFunctional)

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 reflection 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()

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)

getParameters

public java.lang.Object[] getParameters()

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

Throws:
java.io.IOException

getComponentInterfaceName

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

Returns:
the name of the invoked Fractal interface

setComponentInterfaceName

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

Parameters:
string - the functional name of the invoked Fractal interface

writeTheObject

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

readTheObject

protected void readTheObject(java.io.ObjectInputStream in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Throws:
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 . If the caller asks for a RuntimeException or a NFE, then the call is not one way.

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

setBarrierTags

public void setBarrierTags(java.util.LinkedList barrierTags)
Set the tags for barrier to the method call (by copy)

Parameters:
barrierTags - the list of tags

getBarrierTags

public java.util.LinkedList getBarrierTags()
Get the tags for barrier to the method call (by copy)

Returns:
the list of barrier tags

getMetadata

public MethodCallMetadata getMetadata()

getShortcut

public Shortcut getShortcut()

shortcutNotification

public void shortcutNotification(UniversalBody sender,
                                 UniversalBody intermediate)

isComponentMethodCall

public boolean isComponentMethodCall()

isComponentControllerMethodCall

public boolean isComponentControllerMethodCall()

isComponentMethodCallOnComponent

public boolean isComponentMethodCallOnComponent()

getPriority

public short getPriority()


Copyright 2001-2005 INRIA All Rights Reserved.