org.jboss.invocation
Class InvokerInterceptor

java.lang.Object
  extended by org.jboss.proxy.Interceptor
      extended by org.jboss.invocation.InvokerInterceptor
All Implemented Interfaces:
Externalizable, Serializable
Direct Known Subclasses:
ByValueInvokerInterceptor, MarshallingInvokerInterceptor

public class InvokerInterceptor
extends Interceptor
implements Externalizable

A very simple implementation of it that branches to the local stuff.

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

Field Summary
protected static Class invokerProxyHA
          The InvokerProxyHA class
protected static Invoker localInvoker
          Static references to local invokers.
protected  Invoker remoteInvoker
          Invoker to the remote JMX node.
 
Fields inherited from class org.jboss.proxy.Interceptor
nextInterceptor
 
Constructor Summary
InvokerInterceptor()
          Exposed for externalization.
 
Method Summary
protected  org.jboss.remoting.serialization.IMarshalledValue createMarshalledValueForCallByValue(Object value)
           
static Invoker getLocal()
          Get the local invoker reference, useful for optimization.
 boolean hasLocalTarget(Invocation invocation)
          Whether there is a local target
 Object invoke(Invocation invocation)
          The invocation on the delegate, calls the right invoker.
protected  Object invokeInvoker(Invocation invocation)
          Invoke using invoker
protected  Object invokeLocal(Invocation invocation)
          Invoke using local invoker
protected  Object invokeLocalMarshalled(Invocation invocation)
          This method is for local calls when using pass-by-value
protected  Object invokeMarshalled(Invocation invocation)
          Invoke using local invoker and marshalled
 boolean isClustered(Invocation invocation)
          Whether we are in a clustered environment
 boolean isLocal()
          Returns wether we are local to the originating container or not.
 boolean isLocal(Invocation invocation)
          Whether the target is local
 void readExternal(ObjectInput in)
          Un-externalize this instance.
static void setLocal(Invoker invoker)
          Set the local invoker reference, useful for optimization.
 void writeExternal(ObjectOutput out)
          Externalize this instance.
 
Methods inherited from class org.jboss.proxy.Interceptor
getNext, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

remoteInvoker

protected Invoker remoteInvoker
Invoker to the remote JMX node.


localInvoker

protected static Invoker localInvoker
Static references to local invokers.


invokerProxyHA

protected static Class invokerProxyHA
The InvokerProxyHA class

Constructor Detail

InvokerInterceptor

public InvokerInterceptor()
Exposed for externalization.

Method Detail

getLocal

public static Invoker getLocal()
Get the local invoker reference, useful for optimization.


setLocal

public static void setLocal(Invoker invoker)
Set the local invoker reference, useful for optimization.


isLocal

public boolean isLocal()
Returns wether we are local to the originating container or not.

Returns:
true when we have the same GUID

isLocal

public boolean isLocal(Invocation invocation)
Whether the target is local

Parameters:
invocation - the invocation
Returns:
true when the target is local

isClustered

public boolean isClustered(Invocation invocation)
Whether we are in a clustered environment

NOTE: This should be future compatible under any new design where a prior target chooser interceptor picks a non HA target than that code being inside a ha invoker.

Parameters:
invocation - the invocation
Returns:
true when a clustered invoker

hasLocalTarget

public boolean hasLocalTarget(Invocation invocation)
Whether there is a local target

Parameters:
invocation -
Returns:
true when in the registry

invoke

public Object invoke(Invocation invocation)
              throws Exception
The invocation on the delegate, calls the right invoker. Remote if we are remote, local if we are local.

Specified by:
invoke in class Interceptor
Throws:
Exception

invokeLocal

protected Object invokeLocal(Invocation invocation)
                      throws Exception
Invoke using local invoker

Parameters:
invocation - the invocation
Returns:
the result
Throws:
Exception - for any error

invokeMarshalled

protected Object invokeMarshalled(Invocation invocation)
                           throws Exception
Invoke using local invoker and marshalled

Parameters:
invocation - the invocation
Returns:
the result
Throws:
Exception - for any error

createMarshalledValueForCallByValue

protected org.jboss.remoting.serialization.IMarshalledValue createMarshalledValueForCallByValue(Object value)
                                                                                         throws IOException
Throws:
IOException

invokeLocalMarshalled

protected Object invokeLocalMarshalled(Invocation invocation)
                                throws Exception
This method is for local calls when using pass-by-value

Throws:
Exception

invokeInvoker

protected Object invokeInvoker(Invocation invocation)
                        throws Exception
Invoke using invoker

Parameters:
invocation - the invocation
Returns:
the result
Throws:
Exception - for any error

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Externalize this instance.

If this instance lives in a different VM than its container invoker, the remote interface of the container invoker is not externalized.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class Interceptor
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Un-externalize this instance.

We check timestamps of the interfaces to see if the instance is in the original VM of creation

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class Interceptor
Throws:
IOException
ClassNotFoundException


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