FileDocCategorySizeDatePackage
StatelessClusteredProxy.javaAPI DocJBoss 4.2.15264Fri Jul 13 20:53:52 BST 2007org.jboss.ejb3.stateless

StatelessClusteredProxy

public class StatelessClusteredProxy extends org.jboss.ejb3.remoting.BaseRemoteProxy
InvocationHandler for a clustered SLSB proxy.
author
Bill Burke
author
Brian Stansberry
version
$Revision: 61668 $

Fields Summary
private static final long
serialVersionUID
protected org.jboss.aspects.remoting.FamilyWrapper
family
protected org.jboss.ha.framework.interfaces.LoadBalancePolicy
lbPolicy
org.jboss.aspects.asynch.AsynchProvider
provider
protected String
partitionName
Constructors Summary
public StatelessClusteredProxy(Object containerId, org.jboss.aop.advice.Interceptor[] interceptors, org.jboss.aspects.remoting.FamilyWrapper family, org.jboss.ha.framework.interfaces.LoadBalancePolicy lbPolicy, String partitionName)


             
   
      super(containerId, interceptors);
      this.family = family;
      this.lbPolicy = lbPolicy;
      this.partitionName = partitionName;
   
public StatelessClusteredProxy(org.jboss.aspects.asynch.AsynchProvider provider, Object containerId, org.jboss.aop.advice.Interceptor[] interceptors, org.jboss.aspects.remoting.FamilyWrapper family, org.jboss.ha.framework.interfaces.LoadBalancePolicy lbPolicy, String partitionName)

      this(containerId, interceptors, family, lbPolicy, partitionName);
      this.provider = provider;
   
public StatelessClusteredProxy()

   
Methods Summary
public java.lang.ObjectgetAsynchronousProxy(java.lang.Object proxy)

      Class[] infs = proxy.getClass().getInterfaces();
      if (!ProxyUtils.isAsynchronous(infs))
      {
         Class[] interfaces = ProxyUtils.addAsynchProviderInterface(infs);
         AsynchMixin mixin = new AsynchMixin();
         Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
         StatelessClusteredProxy handler = new StatelessClusteredProxy(mixin, containerId, newInterceptors, family, lbPolicy, partitionName);
         return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
      }

      //I was already asynchronous
      return proxy;
   
public java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)

      if (method.getDeclaringClass() == AsynchProvider.class)
      {
         return provider.getFuture();
      }

      long hash = MethodHashing.calculateHash(method);
      Object ret = ProxyUtils.handleCallLocally(hash, (JBossProxy) proxy, this, method, args);
      if (ret != null)
      {
         return ret;
      }

      MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
      sri.setArguments(args);
      sri.setInstanceResolver(metadata);
      sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, containerId, PayloadKey.AS_IS);
      sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.AS_IS);
      sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.AS_IS);
      sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
      sri.getMetaData().addMetaData(ClusteredIsLocalInterceptor.PARTITION_NAME, ClusteredIsLocalInterceptor.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);

      if (provider != null)
      {
         sri.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
      }
      return sri.invokeNext();
   
public java.lang.StringtoString()

      return containerId.toString();