Author: borges
Date: 2011-10-26 10:16:36 -0400 (Wed, 26 Oct 2011)
New Revision: 11608
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
Fix snafu with isClosed().
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-26
14:16:23 UTC (rev 11607)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-10-26
14:16:36 UTC (rev 11608)
@@ -555,7 +555,7 @@
}
catch (Exception e)
{
- if (!isClosed())
+ if (isInitialized())
{
log.warn("did not connect the cluster connection to other
nodes", e);
}
@@ -608,6 +608,11 @@
return state == STATE.CLOSED || state == STATE.CLOSING;
}
+ public boolean isInitialized()
+ {
+ return state == STATE.INITIALIZED;
+ }
+
public ClientSessionFactory createSessionFactory(final TransportConfiguration
transportConfiguration) throws Exception
{
assertOpen();
@@ -700,6 +705,8 @@
try
{
+ assertOpen();
+
factory =
new ClientSessionFactoryImpl(this, tc, callTimeout,
clientFailureCheckPeriod, connectionTTL,
retryInterval,
retryIntervalMultiplier, maxRetryInterval,
@@ -748,7 +755,7 @@
if (ha || clusterConnection)
{
long timeout = System.currentTimeMillis() + 30000;
- while (!isClosed() && !receivedTopology && timeout >
System.currentTimeMillis())
+ while (isInitialized() && !receivedTopology && timeout >
System.currentTimeMillis())
{
// Now wait for the topology
@@ -1537,7 +1544,7 @@
{
int retryNumber = 0;
- while (csf == null && isClosed())
+ while (csf == null && isInitialized())
{
retryNumber++;
for (Connector conn : connectors)
@@ -1590,7 +1597,7 @@
break;
}
- if (!isClosed())
+ if (isInitialized())
{
Thread.sleep(retryInterval);
}
@@ -1603,7 +1610,7 @@
throw new HornetQException(HornetQException.NOT_CONNECTED, "Failed to
connect to any static connectors", e);
}
- if (csf == null && !isClosed())
+ if (csf == null && isInitialized())
{
log.warn("Failed to connecto to any static connector, throwing exception
now");
throw new HornetQException(HornetQException.NOT_CONNECTED, "Failed to
connect to any static connectors");
Show replies by date