[hornetq-commits] JBoss hornetq SVN: r11115 - branches/Branch_2_2_AS7/src/main/org/hornetq/jms/server/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Aug 4 08:23:43 EDT 2011


Author: ataylor
Date: 2011-08-04 08:23:43 -0400 (Thu, 04 Aug 2011)
New Revision: 11115

Modified:
   branches/Branch_2_2_AS7/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
Log:
https://issues.jboss.org/browse/HORNETQ-750

Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2011-08-04 10:56:11 UTC (rev 11114)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2011-08-04 12:23:43 UTC (rev 11115)
@@ -103,11 +103,6 @@
 
    private BindingRegistry registry;
 
-   /**
-    * the context to bind to
-    */
-   private Context context;
-
    private Map<String, HornetQQueue> queues = new HashMap<String, HornetQQueue>();
 
    private Map<String, HornetQTopic> topics = new HashMap<String, HornetQTopic>();
@@ -264,8 +259,7 @@
       if (registry == null)
       {
          if (!contextSet)
-            context = new InitialContext();
-         registry = new JndiBindingRegistry(context);
+          registry = new JndiBindingRegistry(new InitialContext());
       }
 
       deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());
@@ -326,9 +320,9 @@
       topicJNDI.clear();
       topics.clear();
 
-      if (context != null)
+      if (registry != null)
       {
-         context.close();
+         registry.close();
       }
 
       // it could be null if a backup
@@ -388,10 +382,9 @@
 
    public synchronized void setContext(final Context context)
    {
-      this.context = context;
-
-      if (registry != null && registry instanceof JndiBindingRegistry)
+      if (registry == null || registry instanceof JndiBindingRegistry)
       {
+         registry = new JndiBindingRegistry(context);
          registry.setContext(context);
       }
 
@@ -1469,7 +1462,7 @@
     */
    private void unbindJNDI(Map<String, List<String>> param)
    {
-      if (context != null)
+      if (registry != null)
       {
          for (List<String> elementList : param.values())
          {
@@ -1477,7 +1470,7 @@
             {
                try
                {
-                  context.unbind(key);
+                  registry.unbind(key);
                }
                catch (Exception e)
                {
@@ -1608,13 +1601,13 @@
       {
          keys.remove(name);
       }
-      if (context != null)
+      if (registry != null)
       {
          Iterator<String> iter = jndiBindings.iterator();
          while (iter.hasNext())
          {
             String jndiBinding = iter.next();
-            context.unbind(jndiBinding);
+            registry.unbind(jndiBinding);
             iter.remove();
          }
       }
@@ -1634,7 +1627,7 @@
 
       if (jndiBindings.remove(jndi))
       {
-         context.unbind(jndi);
+         registry.unbind(jndi);
          return true;
       }
       else



More information about the hornetq-commits mailing list