站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

MarshalledInvocation (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.invocation
Class MarshalledInvocation

java.lang.Object
  extended byorg.jboss.invocation.Invocation
      extended byorg.jboss.invocation.MarshalledInvocation
All Implemented Interfaces:
Externalizable, Serializable
Direct Known Subclasses:
PooledMarshalledInvocation

public class MarshalledInvocation
extends Invocation
implements Externalizable

The MarshalledInvocation is an invocation that travels. As such it serializes its payload because of lack of ClassLoader visibility. As such it contains Marshalled data representing the byte[] of the Invocation object it extends Besides handling the specifics of "marshalling" the payload, which could be done at the Invocation level the Marshalled Invocation can hold optimization and needed code for distribution for example the TransactionPropagationContext which is a serialization of the TX for distribution purposes as well as the "hash" for the methods that we send, as opposed to sending Method objects. Serialization "optimizations" should be coded here in the externalization implementation of the class

Version:
$Revision: 1.17.6.2 $
Author:
Marc Fleury, Bill.Burke@jboss.org, Scott.Stark@jboss.org
See Also:
Serialized Form

Field Summary
protected  MarshalledValue marshalledArgs
           
protected  long methodHash
           
protected  Map methodMap
          The Map of methods used by this Invocation
protected  Object tpc
          The Transaction Propagation Context for distribution
 
Fields inherited from class org.jboss.invocation.Invocation
args, as_is_payload, invocationContext, invocationType, INVOKE_SIGNATURE, method, objectName, payload, transient_payload
 
Constructor Summary
MarshalledInvocation()
           
MarshalledInvocation(Invocation invocation)
           
MarshalledInvocation(Object id, Method m, Object[] args, Transaction tx, Principal identity, Object credential)
           
 
Method Summary
static long calculateHash(Method method)
           
 Object[] getArguments()
           
static Map getFullInterfaceHashes(Class intf)
          Calculate method full hashes.
static Map getInterfaceHashes(Class intf)
          Calculate method hashes.
 Method getMethod()
          get on method Return the invocation method.
 Object getPayloadValue(Object key)
          A Marshalled invocation has serialized data in the form of MarshalledValue objects.
 Object getTransactionPropagationContext()
           
static boolean getUseFullHashMode()
          Get the full hash mode flag.
 Object getValue(Object key)
          A Marshalled invocation has serialized data in the form of MarshalledValue objects.
static Map methodToHashesMap(Class c)
          Calculate method hashes.
 void readExternal(ObjectInput in)
           
static void removeHashes(Class declaringClass)
          Remove all method hashes for the declaring class
 void setMethodMap(Map methods)
           
 void setTransactionPropagationContext(Object tpc)
           
static void setUseFullHashMode(boolean flag)
          Set the full hash mode flag.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.jboss.invocation.Invocation
getAsIsPayload, getAsIsValue, getCredential, getEnterpriseContext, getId, getInvocationContext, getObjectName, getPayload, getPrincipal, getTransaction, getTransientPayload, getTransientValue, getType, isLocal, performCall, setArguments, setCredential, setEnterpriseContext, setId, setInvocationContext, setMethod, setObjectName, setPrincipal, setTransaction, setType, setValue, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tpc

protected Object tpc
The Transaction Propagation Context for distribution


methodMap

protected transient Map methodMap
The Map of methods used by this Invocation


methodHash

protected transient long methodHash

marshalledArgs

protected transient MarshalledValue marshalledArgs
Constructor Detail

MarshalledInvocation

public MarshalledInvocation()

MarshalledInvocation

public MarshalledInvocation(Invocation invocation)

MarshalledInvocation

public MarshalledInvocation(Object id,
                            Method m,
                            Object[] args,
                            Transaction tx,
                            Principal identity,
                            Object credential)
Method Detail

getUseFullHashMode

public static boolean getUseFullHashMode()
Get the full hash mode flag.

Returns:
the full hash mode flag.

setUseFullHashMode

public static void setUseFullHashMode(boolean flag)
Set the full hash mode flag. When true, method hashes are calculated using the getFullInterfaceHashes which is able to differentiate methods by declaring class, return value, name and arg signature, and exceptions. Otherwise, the getInterfaceHashes method uses, and this is only able to differentiate classes by return value, name and arg signature. A useFullHashMode = false is compatible with 3.2.3 and earlier. This needs to be set consistently on the server and the client.

Parameters:
flag - the full method hash calculation mode flag.

getInterfaceHashes

public static Map getInterfaceHashes(Class intf)
Calculate method hashes. This algo is taken from RMI with the method string built from the method name + parameters + return type. Note that this is not able to distinguish type compatible methods from different interfaces.

Parameters:
intf - - the class/interface to calculate method hashes for.
Returns:
Map mapping of method string to method desc hash

getFullInterfaceHashes

public static Map getFullInterfaceHashes(Class intf)
Calculate method full hashes. This algo is taken from RMI with the full method string built from the method toString() which includes the modifiers, return type, declaring class, name, parameters and exceptions.

Parameters:
intf - - the class/interface to calculate method hashes for.
Returns:
Map mapping of method string to method desc hash

methodToHashesMap

public static Map methodToHashesMap(Class c)
Calculate method hashes. This algo is taken from RMI with the full method string taken from the method.toString to include the declaring class.

Parameters:
c - the class/interface to calculate method hashes for.
Returns:
Map mapping of method hash to the Method object.

calculateHash

public static long calculateHash(Method method)

removeHashes

public static void removeHashes(Class declaringClass)
Remove all method hashes for the declaring class

Parameters:
declaringClass - a class for which a calculateHash(Method) was called

getMethod

public Method getMethod()
Description copied from class: Invocation
get on method Return the invocation method.

Overrides:
getMethod in class Invocation

setMethodMap

public void setMethodMap(Map methods)

setTransactionPropagationContext

public void setTransactionPropagationContext(Object tpc)

getTransactionPropagationContext

public Object getTransactionPropagationContext()

getValue

public Object getValue(Object key)
A Marshalled invocation has serialized data in the form of MarshalledValue objects. We overwrite the "getValue" to deserialize the data, this assume that the thread context class loader has visibility on the classes.

Overrides:
getValue in class Invocation

getPayloadValue

public Object getPayloadValue(Object key)
A Marshalled invocation has serialized data in the form of MarshalledValue objects. We overwrite the "getValue" to deserialize the data, this assume that the thread context class loader has visibility on the classes.

Overrides:
getPayloadValue in class Invocation

getArguments

public Object[] getArguments()
Overrides:
getArguments in class Invocation

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


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.