[jboss-cvs] JBossAS SVN: r106089 - trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jun 16 11:10:51 EDT 2010


Author: pete.muir at jboss.org
Date: 2010-06-16 11:10:51 -0400 (Wed, 16 Jun 2010)
New Revision: 106089

Modified:
   trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java
Log:
workaround lack of ability to retrieve handle on no-interface ejbs

Modified: trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java
===================================================================
--- trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java	2010-06-16 15:09:33 UTC (rev 106088)
+++ trunk/weld-int/ejb/src/main/java/org/jboss/weld/integration/ejb/JBossSessionObjectReference.java	2010-06-16 15:10:51 UTC (rev 106089)
@@ -11,6 +11,7 @@
 import org.jboss.ejb3.endpoint.Endpoint;
 import org.jboss.ejb3.endpoint.deployers.EndpointResolver;
 import org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandler;
+import org.jboss.logging.Logger;
 import org.jboss.weld.ejb.api.SessionObjectReference;
 import org.jboss.weld.ejb.spi.EjbDescriptor;
 
@@ -18,6 +19,8 @@
 public class JBossSessionObjectReference implements SessionObjectReference
 {
 
+   private static Logger log = Logger.getLogger(JBossSessionObjectReference.class);
+   
    private static final String MC_BIND_NAME_ENDPOINT_RESOLVER = "EJB3EndpointResolver";
 
    private static final long serialVersionUID = 8227728506645839338L;
@@ -37,11 +40,15 @@
       {
          throw new IllegalArgumentException("Can only operate on JBoss EJB3");
       }
+      this.jndiName = ((JBossSessionBeanDescriptorAdaptor<?>) descriptor).getLocalJndiName();
+      reference = context.lookup(jndiName);
+      if (descriptor instanceof JBossSessionBean31DescriptorAdaptor<?> && ((JBossSessionBean31DescriptorAdaptor<?>) descriptor).isNoInterfaceView())
+      {
+         this.id = null;
+      }
       else
       {
-         this.jndiName = ((JBossSessionBeanDescriptorAdaptor<?>) descriptor).getLocalJndiName();
-         reference = context.lookup(jndiName);
-         final SessionProxyInvocationHandler handler = (SessionProxyInvocationHandler) Proxy.getInvocationHandler(reference);
+         SessionProxyInvocationHandler handler = (SessionProxyInvocationHandler) Proxy.getInvocationHandler(reference);
          id = (Serializable) handler.getTarget();
       }
       this.deploymentUnit = ((JBossSessionBeanDescriptorAdaptor<?>) descriptor).getDeploymentUnit();
@@ -57,8 +64,14 @@
 
    public void remove()
    {
-      if (stateful)
+      if (id == null && stateful)
       {
+         log.warn("Cannot remove EJB, id unknown (likely because this is a no-interface view!)");
+         removed = true;
+         return;
+      }
+      else if (stateful)
+      {
          getEndpoint().getSessionFactory().destroySession(id);
          removed = true;
       }



More information about the jboss-cvs-commits mailing list