[jboss-cvs] JBoss Messaging SVN: r7683 - in trunk: src/main/org/jboss/messaging/core/remoting/impl and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 7 04:54:09 EDT 2009


Author: timfox
Date: 2009-08-07 04:54:08 -0400 (Fri, 07 Aug 2009)
New Revision: 7683

Modified:
   trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
   trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/ChannelImpl.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/ManualReconnectionToSingleServerTest.java
Log:
Fixed exception listener reconnect issue

Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java	2009-08-07 08:07:49 UTC (rev 7682)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java	2009-08-07 08:54:08 UTC (rev 7683)
@@ -250,9 +250,7 @@
    }
 
    private void initialise() throws Exception
-   {
-      setThreadPools();
-
+   {      
       instantiateLoadBalancingPolicy();
 
       if (discoveryAddress != null)
@@ -355,6 +353,8 @@
       reconnectAttempts = DEFAULT_RECONNECT_ATTEMPTS;
 
       failoverOnServerShutdown = DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
+      
+      setThreadPools();
    }
 
    public ClientSessionFactoryImpl(final String discoveryAddress, final int discoveryPort)

Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java	2009-08-07 08:07:49 UTC (rev 7682)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java	2009-08-07 08:54:08 UTC (rev 7683)
@@ -558,7 +558,7 @@
          boolean attemptFailover = (backupConnectorFactory) != null && (failoverOnServerShutdown || me.getCode() != MessagingException.DISCONNECTED);
          
          if (attemptFailover || reconnectAttempts != 0)
-         {
+         {  
             lockAllChannel1s();
 
             final boolean needToInterrupt;
@@ -657,10 +657,7 @@
             {
                // Fail the old connections so their listeners get called
 
-               for (RemotingConnection connection : oldConnections)
-               {
-                  connection.fail(me);
-               }
+               failConnections(me);
             }
          }
          else
@@ -695,7 +692,7 @@
    {
       // We re-attach sessions per connection to ensure there is the same mapping of channel id
       // on live and backup connections
-
+      
       Map<RemotingConnection, List<ClientSessionInternal>> sessionsPerConnection = new HashMap<RemotingConnection, List<ClientSessionInternal>>();
 
       for (Map.Entry<ClientSessionInternal, RemotingConnection> entry : sessions.entrySet())
@@ -780,7 +777,7 @@
       long interval = retryInterval;
 
       int count = 0;
-
+      
       while (true)
       {
          if (closed)

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/ChannelImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/ChannelImpl.java	2009-08-07 08:07:49 UTC (rev 7682)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/ChannelImpl.java	2009-08-07 08:54:08 UTC (rev 7683)
@@ -543,13 +543,14 @@
       }
    }
 
-   public synchronized void confirm(final Packet packet)
+   public void confirm(final Packet packet)
    {
       if (resendCache != null && packet.isRequiresConfirmations())
       {
          lastReceivedCommandID++;
 
          receivedBytes += packet.getPacketSize();
+         
          if (receivedBytes >= confWindowSize)
          {
             receivedBytes = 0;

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/ManualReconnectionToSingleServerTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/ManualReconnectionToSingleServerTest.java	2009-08-07 08:07:49 UTC (rev 7682)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/ManualReconnectionToSingleServerTest.java	2009-08-07 08:54:08 UTC (rev 7683)
@@ -56,19 +56,15 @@
 import javax.jms.Session;
 import javax.jms.Topic;
 import javax.naming.Context;
-import javax.naming.InitialContext;
 
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.jboss.messaging.core.server.Messaging;
 import org.jboss.messaging.core.server.MessagingServer;
 import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
-import org.jboss.messaging.jms.JBossQueue;
-import org.jboss.messaging.jms.client.JBossConnection;
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
 import org.jboss.messaging.tests.unit.util.InVMContext;
 import org.jboss.messaging.tests.util.UnitTestCase;
@@ -140,11 +136,11 @@
 
    // Public --------------------------------------------------------
 
-   public void _testExceptionListener() throws Exception
+   public void testExceptionListener() throws Exception
    {
       connect();
       
-      int num = 50;
+      int num = 10;
       for (int i = 0; i < num; i++)
       {
          try
@@ -161,7 +157,7 @@
          if (i == num / 2)
          {
             killServer();
-            Thread.sleep(10000);
+            Thread.sleep(5000);
             restartServer();
             afterRestart = true;
          }




More information about the jboss-cvs-commits mailing list