FileDocCategorySizeDatePackage
ServiceRemoteProxy.javaAPI DocJBoss 4.2.14344Fri Jul 13 20:53:50 BST 2007org.jboss.ejb3.service

ServiceRemoteProxy

public class ServiceRemoteProxy extends org.jboss.ejb3.remoting.BaseRemoteProxy
author
Kabir Khan
version
$Revision: 60233 $

Fields Summary
private static final long
serialVersionUID
protected org.jboss.remoting.InvokerLocator
uri
org.jboss.aspects.asynch.AsynchProvider
provider
Constructors Summary
public ServiceRemoteProxy(Object containerId, org.jboss.aop.advice.Interceptor[] interceptors, org.jboss.remoting.InvokerLocator uri)


         
   
      super(containerId, interceptors);
      this.uri = uri;
   
public ServiceRemoteProxy(org.jboss.aspects.asynch.AsynchProvider provider, Object containerId, org.jboss.aop.advice.Interceptor[] interceptors, org.jboss.remoting.InvokerLocator uri)

      super(containerId, interceptors);
      this.uri = uri;
      this.provider = provider;
   
protected ServiceRemoteProxy()

   
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);
         ServiceRemoteProxy handler = new ServiceRemoteProxy(mixin, containerId, newInterceptors, uri);
         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((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(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
      sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);

      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();