[jboss-cvs] JBoss Messaging SVN: r6605 - trunk/src/main/org/jboss/messaging/core/client/impl.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 28 14:28:45 EDT 2009
Author: timfox
Date: 2009-04-28 14:28:45 -0400 (Tue, 28 Apr 2009)
New Revision: 6605
Modified:
trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
Log:
https://jira.jboss.org/jira/browse/JBMESSAGING-1581
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java 2009-04-28 17:54:14 UTC (rev 6604)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java 2009-04-28 18:28:45 UTC (rev 6605)
@@ -278,7 +278,8 @@
{
// This can happen if the connection manager gets closed - e.g. the server gets shut down
- throw new MessagingException(MessagingException.NOT_CONNECTED, "Unable to connect to server using configuration " + connectorConfig);
+ throw new MessagingException(MessagingException.NOT_CONNECTED,
+ "Unable to connect to server using configuration " + connectorConfig);
}
channel1 = connection.getChannel(1, -1, false);
@@ -454,7 +455,7 @@
// --------------------------------------------------------------------------------------
private boolean handleConnectionFailure(final MessagingException me, final Object connectionID)
- {
+ {
return !failoverOrReconnect(me, connectionID);
}
@@ -506,7 +507,7 @@
boolean attemptFailover = (backupConnectorFactory) != null && (failoverOnServerShutdown || me.getCode() != MessagingException.SERVER_DISCONNECTED);
boolean done = false;
-
+
if (attemptFailover || reconnectAttempts != 0)
{
lockAllChannel1s();
@@ -561,6 +562,16 @@
refCount = 0;
mapIterator = null;
+
+ try
+ {
+ connector.close();
+ }
+ catch (Exception ignore)
+ {
+ }
+
+ connector = null;
if (attemptFailover)
{
@@ -574,10 +585,10 @@
backupTransportParams = null;
- done = reattachSessions(reconnectAttempts == -1 ? -1 : reconnectAttempts + 1);
+ done = reattachSessions(reconnectAttempts == -1 ? -1 : reconnectAttempts + 1);
}
else if (reconnectAttempts != 0)
- {
+ {
done = reattachSessions(reconnectAttempts);
}
@@ -709,7 +720,7 @@
while (true)
{
if (closed)
- {
+ {
return null;
}
@@ -772,19 +783,31 @@
catch (Throwable ignore)
{
}
- try
- {
- entry.connector.close();
- }
- catch (Throwable ignore)
- {
- }
+ // try
+ // {
+ // entry.connector.close();
+ // }
+ // catch (Throwable ignore)
+ // {
+ // }
}
mapIterator = null;
+
+ try
+ {
+ connector.close();
+ }
+ catch (Throwable ignore)
+ {
+ }
+
+ connector = null;
}
}
+ private Connector connector;
+
private RemotingConnection getConnection(final int initialRefCount)
{
RemotingConnection conn;
@@ -801,12 +824,18 @@
try
{
- connector = connectorFactory.createConnector(transportParams, handler, this);
+ if (connector == null)
+ {
+ connector = connectorFactory.createConnector(transportParams, handler, this);
+ if (connector != null)
+ {
+ connector.start();
+ }
+ }
+
if (connector != null)
{
- connector.start();
-
tc = connector.createConnection();
if (tc == null)
@@ -819,8 +848,8 @@
{
}
+ connector = null;
}
-
}
}
catch (Exception e)
More information about the jboss-cvs-commits
mailing list