[jboss-cvs] JBossAS SVN: r111921 - projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/jndiregistrar.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 3 16:16:24 EDT 2011


Author: dereed
Date: 2011-08-03 16:16:24 -0400 (Wed, 03 Aug 2011)
New Revision: 111921

Modified:
   projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/jndiregistrar/JndiSessionRegistrarBase.java
Log:
[EJBTHREE-2265] Don't register an EJB proxy and then immediately unregister and re-register a different one when using @RemoteBinding/<remote-binding>


Modified: projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/jndiregistrar/JndiSessionRegistrarBase.java
===================================================================
--- projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/jndiregistrar/JndiSessionRegistrarBase.java	2011-08-03 19:46:17 UTC (rev 111920)
+++ projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/jndiregistrar/JndiSessionRegistrarBase.java	2011-08-03 20:16:24 UTC (rev 111921)
@@ -199,6 +199,8 @@
       boolean hasLocalView = (localHome != null || hasLocalBusinessView);
       boolean hasRemoteView = (remoteHome != null || hasRemoteBusinessView);
 
+      boolean bindDefaultFactory = true;
+
       /*
        * Create and Register Proxy Factories
        */
@@ -242,16 +244,6 @@
 
          // Create and register a remote proxy factory
          String defaultRemoteProxyFactoryKey = this.getProxyFactoryRegistryKey(defaultRemoteJndiName, smd, false);
-         ProxyFactory factory = this.createRemoteProxyFactory(defaultRemoteProxyFactoryKey, containerName,
-               containerGuid, smd, cl, defaultClientBindUrl, advisor, null);
-         try
-         {
-            this.registerProxyFactory(defaultRemoteProxyFactoryKey, factory, smd);
-         }
-         catch (DuplicateBindException dbe)
-         {
-            throw new RuntimeException(dbe);
-         }
 
          // Get Classname to set for Reference
          String defaultRemoteClassName = this.getHumanReadableListOfInterfacesInRefAddrs(refAddrsForRemote);
@@ -260,8 +252,6 @@
          Reference defaultRemoteRef = createStandardReference(JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX
                + defaultRemoteClassName, defaultRemoteProxyFactoryKey, containerName, false);
 
-         // Also bind remote proxy factory to jndi
-         this.bindRemoteProxyFactory(context, defaultRemoteProxyFactoryKey, defaultClientBindUrl, factory, cl, smd);
          /*
           * Set up references for Home
           */
@@ -403,6 +393,9 @@
 
                // Create and register a remote proxy factory specific to this binding
                String remoteBindingProxyFactoryKey = this.getProxyFactoryRegistryKey(remoteBindingJndiName, smd, false);
+               if ( defaultRemoteProxyFactoryKey.equals ( remoteBindingProxyFactoryKey ) )
+                  bindDefaultFactory = false;
+
                ProxyFactory remoteBindingProxyFactory = null;
                boolean reregister = true;
                try
@@ -475,6 +468,24 @@
             }
          }
 
+         // Only bind the default if there are no remote bindings defined.
+         if (bindDefaultFactory)
+         {
+            ProxyFactory factory = this.createRemoteProxyFactory(defaultRemoteProxyFactoryKey, containerName,
+                  containerGuid, smd, cl, defaultClientBindUrl, advisor, null);
+            try
+            {
+               this.registerProxyFactory(defaultRemoteProxyFactoryKey, factory, smd);
+            }
+            catch (DuplicateBindException dbe)
+            {
+               throw new RuntimeException(dbe);
+            }
+
+            // Also bind remote proxy factory to jndi
+            this.bindRemoteProxyFactory(context, defaultRemoteProxyFactoryKey, defaultClientBindUrl, factory, cl, smd);
+         }
+
          // Bind ObjectFactory specific to each Remote Business Interface
          if (businessRemotes != null)
          {



More information about the jboss-cvs-commits mailing list