Class MethodCall

java.lang.Object
org.jgroups.blocks.MethodCall
All Implemented Interfaces:
Externalizable, Serializable

public class MethodCall extends Object implements Externalizable
A method call is the JGroups representation of a remote method. It includes the name of the method (case sensitive) and a list of arguments. A method call is serializable and can be passed over the wire.
Version:
$Revision: 1.24.6.2 $
Author:
Bela Ban
See Also:
  • Field Details

    • method_name

      protected String method_name
      The name of the method, case sensitive.
    • method_id

      protected short method_id
      The ID of a method, maps to a java.lang.reflect.Method
    • args

      protected Object[] args
      The arguments of the method.
    • types

      protected Class[] types
      The class types, e.g., new Class[]{String.class, int.class}.
    • signature

      protected String[] signature
      The signature, e.g., new String[]{String.class.getName(), int.class.getName()}.
    • method

      protected Method method
      The Method of the call.
    • payload

      protected Map payload
      To carry arbitrary data with a method call, data needs to be serializable if sent across the wire
    • log

      protected static final org.apache.commons.logging.Log log
    • mode

      protected short mode
      Which mode to use.
    • OLD

      protected static final short OLD
      Infer the method from the arguments.
      See Also:
    • METHOD

      protected static final short METHOD
      Explicitly ship the method, caller has to determine method himself.
      See Also:
    • TYPES

      protected static final short TYPES
      Use class information.
      See Also:
    • SIGNATURE

      protected static final short SIGNATURE
      Provide a signature, similar to JMX.
      See Also:
    • ID

      protected static final short ID
      Use an ID to map to a method
      See Also:
  • Constructor Details

    • MethodCall

      public MethodCall()
      Creates an empty method call, this is always invalid, until setName() has been called.
    • MethodCall

      public MethodCall(Method method)
    • MethodCall

      public MethodCall(Method method, Object[] arguments)
    • MethodCall

      public MethodCall(String method_name, Object[] args)
      Deprecated.
      Use one of the constructors that take class types as arguments
      Parameters:
      method_name -
      args -
    • MethodCall

      public MethodCall(short method_id, Object[] args)
    • MethodCall

      public MethodCall(String method_name, Object[] args, Class[] types)
    • MethodCall

      public MethodCall(String method_name, Object[] args, String[] signature)
  • Method Details

    • getMode

      public int getMode()
    • getName

      public String getName()
      returns the name of the method to be invoked using this method call object
      Returns:
      a case sensitive name, can be null for an invalid method call
    • setName

      public void setName(String n)
      sets the name for this MethodCall and allowing you to reuse the same object for a different method invokation of a different method
      Parameters:
      n - - a case sensitive method name
    • getId

      public short getId()
    • setId

      public void setId(short method_id)
    • getArgs

      public Object[] getArgs()
      returns an ordered list of arguments used for the method invokation
      Returns:
      returns the list of ordered arguments
    • setArgs

      public void setArgs(Object[] args)
    • getMethod

      public Method getMethod()
    • setMethod

      public void setMethod(Method m)
    • put

      public Object put(Object key, Object value)
    • get

      public Object get(Object key)
    • invoke

      public Object invoke(Object target) throws Throwable
      Invokes the method with the supplied arguments against the target object. If a method lookup is provided, it will be used. Otherwise, the default method lookup will be used.
      Parameters:
      target - - the object that you want to invoke the method on
      Returns:
      an object
      Throws:
      Throwable
    • invoke

      public Object invoke(Object target, Object[] args) throws Throwable
      Throws:
      Throwable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStringDetails

      public String toStringDetails()
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException