[jboss-cvs] JBossAS SVN: r73322 - in projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3: proxy/handler/stateful and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 12 22:46:52 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-05-12 22:46:52 -0400 (Mon, 12 May 2008)
New Revision: 73322

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java
Log:
[EJBTHREE-1356] StatefulClusteredProxyFactory should create StatefulClusteredInvocationHandler

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java	2008-05-13 01:34:51 UTC (rev 73321)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulRemoteProxyFactory.java	2008-05-13 02:46:52 UTC (rev 73322)
@@ -130,7 +130,7 @@
       return homeJndiName.equals(remoteBusinessJndiName);
    }
    
-   Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
+   protected Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
    {
       String stackName = this.getStackNameInterceptors();
       RemoteBinding binding = this.getBinding();

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java	2008-05-13 01:34:51 UTC (rev 73321)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java	2008-05-13 02:46:52 UTC (rev 73322)
@@ -27,9 +27,12 @@
 import javax.ejb.RemoteHome;
 import javax.naming.NamingException;
 
+import org.jboss.aop.AspectManager;
 import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.AdviceStack;
 import org.jboss.aspects.remoting.FamilyWrapper;
 import org.jboss.aspects.remoting.Remoting;
+import org.jboss.ejb3.SpecificationInterfaceType;
 import org.jboss.ejb3.annotation.Clustered;
 import org.jboss.ejb3.annotation.RemoteBinding;
 import org.jboss.ejb3.annotation.defaults.ClusteredDefaults;
@@ -37,6 +40,7 @@
 import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
 import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
 import org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry;
+import org.jboss.ejb3.proxy.handler.stateful.StatefulClusteredInvocationHandler;
 import org.jboss.ejb3.remoting.LoadBalancePolicyNotRegisteredException;
 import org.jboss.ejb3.session.ProxyAccessType;
 import org.jboss.ejb3.session.SessionContainer;
@@ -72,6 +76,7 @@
    private DistributedReplicantManager drm;
    private HATarget hatarget;
    private String proxyFamilyName;
+   private String partitionName;
    private LoadBalancePolicy lbPolicy;
    private FamilyWrapper wrapper;
 
@@ -139,7 +144,7 @@
       RemoteBinding binding = this.getBinding();
       InvokerLocator locator = this.getLocator();
       SessionContainer container = this.getContainer();
-      String partitionName = container.getPartitionName();
+      partitionName = container.getPartitionName();
       proxyFamilyName = container.getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
       HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, container.getInitialContextProperties());
       hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
@@ -195,10 +200,29 @@
    {
       return StatefulClusterProxyFactory.STACK_NAME_CLUSTERED_STATEFUL_SESSION_CLIENT_INTERCEPTORS;
    }
-
-   public Object createProxyBusiness(Object id)
+   
+   @Override
+   protected Object createProxy(Object id,SpecificationInterfaceType type, String businessInterfaceType)
    {
-      throw new RuntimeException("NYI");
+      String stackName = this.getStackNameInterceptors();
+      RemoteBinding binding = this.getBinding();
+      if (binding.interceptorStack() != null && !binding.interceptorStack().trim().equals(""))
+      {
+         stackName = binding.interceptorStack();
+      }
+      AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+      if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
+      StatefulClusteredInvocationHandler handler = new StatefulClusteredInvocationHandler(getContainer(), stack.createInterceptors(getContainer()
+            .getAdvisor(), null), this.wrapper, this.lbPolicy, partitionName, id, businessInterfaceType);
+      
+      if(type.equals(SpecificationInterfaceType.EJB21))
+      {
+         return this.constructEjb21Proxy(handler);
+      }
+      else
+      {
+         return this.constructProxyBusiness(handler);
+      }
    }
    
    public void stop() throws Exception

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java	2008-05-13 01:34:51 UTC (rev 73321)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/stateful/StatefulClusteredInvocationHandler.java	2008-05-13 02:46:52 UTC (rev 73322)
@@ -64,23 +64,25 @@
 
 
    public StatefulClusteredInvocationHandler(Container container, Interceptor[] interceptors, FamilyWrapper family,
-         LoadBalancePolicy lb, String partitionName, String businessInterfaceClassName)
+         LoadBalancePolicy lb, String partitionName, Object id, String businessInterfaceType)
    {
-      super(container, interceptors, businessInterfaceClassName);
+      super(container, interceptors, businessInterfaceType);
       this.family = family;
       this.lbPolicy = lb;
       this.partitionName = partitionName;
+      this.id = id;
    }
 
    public StatefulClusteredInvocationHandler(AsynchProvider provider, String containerId, String containerGuid,
          Interceptor[] interceptors, FamilyWrapper family, LoadBalancePolicy lb, String partitionName,
-         String businessInterfaceClassName)
+         Object id, String businessInterfaceType)
    {
-      super(containerId, containerGuid, interceptors, businessInterfaceClassName);
+      super(containerId, containerGuid, interceptors, businessInterfaceType);
       this.provider = provider;
       this.family = family;
       this.lbPolicy = lb;
       this.partitionName = partitionName;
+      this.id = id;
    }
 
    protected StatefulClusteredInvocationHandler()
@@ -144,7 +146,7 @@
          AsynchMixin mixin = new AsynchMixin();
          Interceptor[] newInterceptors = ProxyUtils.addAsynchProxyInterceptor(mixin, interceptors);
          StatefulClusteredInvocationHandler handler = new StatefulClusteredInvocationHandler(mixin, containerId,
-               containerGuid, newInterceptors, family, lbPolicy, partitionName, this.getBusinessInterfaceType());
+               containerGuid, newInterceptors, family, lbPolicy, partitionName, this.id, this.getBusinessInterfaceType());
          return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, handler);
       }
 

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java	2008-05-13 01:34:51 UTC (rev 73321)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/ProxiedStatefulBeanContext.java	2008-05-13 02:46:52 UTC (rev 73322)
@@ -63,8 +63,12 @@
       
       this.delegate = delegate;
       oid = delegate.getId();
-      containerId = container.getObjectName().getCanonicalName();
+      containerId = delegate.getContainer().getObjectName().getCanonicalName();
       parentRef = new StatefulBeanContextReference(delegate.getContainedIn());
+      
+      // HACK!! Clear superclass fields
+      this.container = null;
+      this.bean = null;
    }
 
    protected StatefulBeanContext getDelegate()
@@ -94,6 +98,8 @@
    }
 
    public void writeExternal(ObjectOutput out) throws IOException
+//   private void writeObject(java.io.ObjectOutputStream out)
+//         throws IOException
    {
       out.writeObject(oid);
       out.writeUTF(containerId);
@@ -102,6 +108,8 @@
 
    public void readExternal(ObjectInput in) throws IOException,
          ClassNotFoundException
+//   private void readObject(java.io.ObjectInputStream in)
+//         throws IOException, ClassNotFoundException
    {
       oid = in.readObject();
       containerId = in.readUTF();
@@ -419,4 +427,24 @@
       // ignore
    }
 
+   @Override
+   public Object getInvokedMethodKey()
+   {
+      return getDelegate().getInvokedMethodKey();
+   }
+
+   @Override
+   public Object getInterceptor(Class<?> interceptorClass) throws IllegalArgumentException
+   {
+      return getDelegate().getInterceptor(interceptorClass);
+   }
+
+   @Override
+   public void initialiseInterceptorInstances()
+   {
+      getDelegate().initialiseInterceptorInstances();
+   }
+   
+   
+
 }




More information about the jboss-cvs-commits mailing list