FileDocCategorySizeDatePackage
StatefulLocalProxy.javaAPI DocJBoss 4.2.13994Fri Jul 13 20:53:50 BST 2007org.jboss.ejb3.stateful

StatefulLocalProxy

public class StatefulLocalProxy extends org.jboss.ejb3.LocalProxy implements Externalizable
Comment
author
Bill Burke
version
$Revision: 60233 $

Fields Summary
private static final long
serialVersionUID
protected Object
id
org.jboss.aspects.asynch.AsynchProvider
provider
Constructors Summary
public StatefulLocalProxy(org.jboss.ejb3.Container container, Object id)




       
   
      super(container);
      this.id = id;
   
public StatefulLocalProxy(org.jboss.aspects.asynch.AsynchProvider provider, org.jboss.ejb3.Container container, Object id)

      super(container);
      this.provider = provider;
      this.id = id;
   
public StatefulLocalProxy()

   
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();
         StatefulLocalProxy handler = new StatefulLocalProxy(mixin, getContainer(), id);
         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();
      }

      //Make sure we get the cache id before getting the asynchronous interface
      StatefulContainer sfsb = (StatefulContainer) getContainer();
      Object ret = ProxyUtils.handleCallLocally(proxy, this, method, args);
      if (ret != null)
      {
         return ret;
      }

      return sfsb.localInvoke(id, method, args, (FutureHolder) provider);
   
public voidreadExternal(java.io.ObjectInput in)

      super.readExternal(in);
      id = in.readObject();
   
public java.lang.StringtoString()

      if (id != null)
      {
         return getContainer().getEjbName().toString() + ":" + id.toString();
      }
      else
      {
         //If the proxy has not been used yet, create a temporary id 
         GUID guid = new GUID();
         return getContainer().getEjbName().toString() + ":" + guid.toString();
      }
   
public voidwriteExternal(java.io.ObjectOutput out)

      super.writeExternal(out);
      out.writeObject(id);