org.jboss.invocation
Class InvokerInterceptor

java.lang.Object
  extended byorg.jboss.proxy.Interceptor (src) 
      extended byorg.jboss.invocation.InvokerInterceptor
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
ByValueInvokerInterceptor (src) , MarshallingInvokerInterceptor (src)

public class InvokerInterceptor
extends Interceptor (src)
implements java.io.Externalizable

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

See Also:
Serialized Form

Field Summary
protected static java.lang.Class invokerProxyHA
          The InvokerProxyHA class
protected static Invoker (src) localInvoker
          Static references to local invokers.
protected  Invoker (src) remoteInvoker
          Invoker to the remote JMX node.
 
Fields inherited from class org.jboss.proxy.Interceptor (src)
nextInterceptor
 
Constructor Summary
InvokerInterceptor()
          Exposed for externalization.
 
Method Summary
static Invoker (src) getLocal()
          Get the local invoker reference, useful for optimization.
 boolean hasLocalTarget(Invocation (src)  invocation)
          Whether there is a local target
 java.lang.Object invoke(Invocation (src)  invocation)
          The invocation on the delegate, calls the right invoker.
protected  java.lang.Object invokeInvoker(Invocation (src)  invocation)
          Invoke using invoker
protected  java.lang.Object invokeLocal(Invocation (src)  invocation)
          Invoke using local invoker
protected  java.lang.Object invokeMarshalled(Invocation (src)  invocation)
          Invoke using local invoker and marshalled
 boolean isClustered(Invocation (src)  invocation)
          Whether we are in a clustered environment
 boolean isLocal()
          Returns wether we are local to the originating container or not.
 boolean isLocal(Invocation (src)  invocation)
          Whether the target is local
 void readExternal(java.io.ObjectInput in)
          Un-externalize this instance.
static void setLocal(Invoker (src)  invoker)
          Set the local invoker reference, useful for optimization.
 void writeExternal(java.io.ObjectOutput out)
          Externalize this instance.
 
Methods inherited from class org.jboss.proxy.Interceptor (src)
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 (src)  remoteInvoker
Invoker to the remote JMX node.


localInvoker

protected static Invoker (src)  localInvoker
Static references to local invokers.


invokerProxyHA

protected static java.lang.Class invokerProxyHA
The InvokerProxyHA class

Constructor Detail

InvokerInterceptor

public InvokerInterceptor()
Exposed for externalization.

Method Detail

getLocal

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


setLocal

public static void setLocal(Invoker (src)  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 (src)  invocation)
Whether the target is local

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

isClustered

public boolean isClustered(Invocation (src)  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 (src)  invocation)
Whether there is a local target

Parameters:
invocation -
Returns:
true when in the registry

invoke

public java.lang.Object invoke(Invocation (src)  invocation)
                        throws java.lang.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 (src)
Throws:
java.lang.Exception

invokeLocal

protected java.lang.Object invokeLocal(Invocation (src)  invocation)
                                throws java.lang.Exception
Invoke using local invoker

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

invokeMarshalled

protected java.lang.Object invokeMarshalled(Invocation (src)  invocation)
                                     throws java.lang.Exception
Invoke using local invoker and marshalled

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

invokeInvoker

protected java.lang.Object invokeInvoker(Invocation (src)  invocation)
                                  throws java.lang.Exception
Invoke using invoker

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

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.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 java.io.Externalizable
Overrides:
writeExternal in class Interceptor (src)
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.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 java.io.Externalizable
Overrides:
readExternal in class Interceptor (src)
Throws:
java.io.IOException
java.lang.ClassNotFoundException