Package org.jgroups.blocks
Class MethodCall
java.lang.Object
org.jgroups.blocks.MethodCall
- All Implemented Interfaces:
Externalizable
,Serializable
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 Summary
FieldsModifier and TypeFieldDescriptionprotected Object[]
The arguments of the method.protected static final short
Use an ID to map to a methodprotected static final org.apache.commons.logging.Log
protected Method
The Method of the call.protected static final short
Explicitly ship the method, caller has to determine method himself.protected short
The ID of a method, maps to a java.lang.reflect.Methodprotected String
The name of the method, case sensitive.protected short
Which mode to use.protected static final short
Infer the method from the arguments.protected Map
To carry arbitrary data with a method call, data needs to be serializable if sent across the wireprotected String[]
The signature, e.g., new String[]{String.class.getName(), int.class.getName()}.protected static final short
Provide a signature, similar to JMX.protected Class[]
The class types, e.g., new Class[]{String.class, int.class}.protected static final short
Use class information. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty method call, this is always invalid, untilsetName()
has been called.MethodCall
(short method_id, Object[] args) MethodCall
(Method method) MethodCall
(Method method, Object[] arguments) MethodCall
(String method_name, Object[] args) Deprecated.Use one of the constructors that take class types as argumentsMethodCall
(String method_name, Object[] args, Class[] types) MethodCall
(String method_name, Object[] args, String[] signature) -
Method Summary
Modifier and TypeMethodDescriptionObject[]
getArgs()
returns an ordered list of arguments used for the method invokationshort
getId()
int
getMode()
getName()
returns the name of the method to be invoked using this method call objectInvokes the method with the supplied arguments against the target object.void
void
void
setId
(short method_id) void
void
sets the name for this MethodCall and allowing you to reuse the same object for a different method invokation of a different methodtoString()
void
-
Field Details
-
method_name
The name of the method, case sensitive. -
method_id
protected short method_idThe ID of a method, maps to a java.lang.reflect.Method -
args
The arguments of the method. -
types
The class types, e.g., new Class[]{String.class, int.class}. -
signature
The signature, e.g., new String[]{String.class.getName(), int.class.getName()}. -
method
The Method of the call. -
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 modeWhich mode to use. -
OLD
protected static final short OLDInfer the method from the arguments.- See Also:
-
METHOD
protected static final short METHODExplicitly ship the method, caller has to determine method himself.- See Also:
-
TYPES
protected static final short TYPESUse class information.- See Also:
-
SIGNATURE
protected static final short SIGNATUREProvide a signature, similar to JMX.- See Also:
-
ID
protected static final short IDUse an ID to map to a method- See Also:
-
-
Constructor Details
-
MethodCall
public MethodCall()Creates an empty method call, this is always invalid, untilsetName()
has been called. -
MethodCall
-
MethodCall
-
MethodCall
Deprecated.Use one of the constructors that take class types as arguments- Parameters:
method_name
-args
-
-
MethodCall
-
MethodCall
-
MethodCall
-
-
Method Details
-
getMode
public int getMode() -
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
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
returns an ordered list of arguments used for the method invokation- Returns:
- returns the list of ordered arguments
-
setArgs
-
getMethod
-
setMethod
-
put
-
get
-
invoke
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
- Throws:
Throwable
-
toString
-
toStringDetails
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-