[hornetq-commits] JBoss hornetq SVN: r11590 - trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Oct 25 08:32:29 EDT 2011


Author: borges
Date: 2011-10-25 08:32:28 -0400 (Tue, 25 Oct 2011)
New Revision: 11590

Modified:
   trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
Stop creation of connectors if locator is closed or closing.

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java	2011-10-25 12:32:12 UTC (rev 11589)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java	2011-10-25 12:32:28 UTC (rev 11590)
@@ -573,19 +573,15 @@
 
    public ClientSessionFactoryInternal connect() throws Exception
    {
-      ClientSessionFactoryInternal sf;
       // static list of initial connectors
       if (initialConnectors != null && discoveryGroup == null)
       {
-         sf = (ClientSessionFactoryInternal)staticConnector.connect();
+         ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)staticConnector.connect();
+         addFactory(sf);
+         return sf;
       }
       // wait for discovery group to get the list of initial connectors
-      else
-      {
-         sf = (ClientSessionFactoryInternal)createSessionFactory();
-      }
-      addFactory(sf);
-      return sf;
+      return (ClientSessionFactoryInternal)createSessionFactory();
    }
 
    /* (non-Javadoc)
@@ -1490,7 +1486,7 @@
 
       public ClientSessionFactory connect() throws HornetQException
       {
-         if (closed)
+         if (closed || closing)
          {
             throw new IllegalStateException("Cannot create session factory, server locator is closed (maybe it has been garbage collected)");
          }
@@ -1598,6 +1594,7 @@
          connectors = new ArrayList<Connector>();
          for (TransportConfiguration initialConnector : initialConnectors)
          {
+            assertOpen();
             ClientSessionFactoryInternal factory = new ClientSessionFactoryImpl(ServerLocatorImpl.this,
                                                                                 initialConnector,
                                                                                 callTimeout,



More information about the hornetq-commits mailing list