[hornetq-commits] JBoss hornetq SVN: r10099 - trunk/src/main/org/hornetq/jms/server/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Jan 1 19:38:16 EST 2011


Author: clebert.suconic at jboss.com
Date: 2011-01-01 19:38:16 -0500 (Sat, 01 Jan 2011)
New Revision: 10099

Modified:
   trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
Log:
Fixing springTest

Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2011-01-01 23:52:51 UTC (rev 10098)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2011-01-02 00:38:16 UTC (rev 10099)
@@ -227,9 +227,9 @@
          return;
       }
 
-      if (!contextSet)
+      if (registry == null)
       {
-         context = new InitialContext();
+         if (!contextSet) context = new InitialContext();
          registry = new JndiBindingRegistry(context);
       }
 
@@ -1284,35 +1284,9 @@
 
    private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException
    {
-      if (context != null)
+      if (registry != null)
       {
-         String parentContext;
-         String jndiNameInContext;
-         int sepIndex = jndiName.lastIndexOf('/');
-         if (sepIndex == -1)
-         {
-            parentContext = "";
-         }
-         else
-         {
-            parentContext = jndiName.substring(0, sepIndex);
-         }
-         jndiNameInContext = jndiName.substring(sepIndex + 1);
-         try
-         {
-            context.lookup(jndiName);
-
-            JMSServerManagerImpl.log.warn("Binding for " + jndiName + " already exists");
-            return false;
-         }
-         catch (Throwable e)
-         {
-            // OK
-         }
-
-         Context c = org.hornetq.utils.JNDIUtil.createContext(context, parentContext);
-
-         c.rebind(jndiNameInContext, objectToBind);
+         registry.bind(jndiName, objectToBind);
       }
       return true;
    }



More information about the hornetq-commits mailing list