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

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Feb 17 05:27:00 EST 2012


Author: borges
Date: 2012-02-17 05:26:56 -0500 (Fri, 17 Feb 2012)
New Revision: 12131

Modified:
   trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
   trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionImpl.java
Log:
FIX race condition when shuting down SessionFactory.

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java	2012-02-17 09:38:02 UTC (rev 12130)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java	2012-02-17 10:26:56 UTC (rev 12131)
@@ -83,8 +83,6 @@
    // Constants
    // ------------------------------------------------------------------------------------
 
-   private static final long serialVersionUID = 2512460695662741413L;
-
    private static final Logger log = Logger.getLogger(ClientSessionFactoryImpl.class);
 
    private static final boolean isTrace = ClientSessionFactoryImpl.log.isTraceEnabled();
@@ -145,7 +143,6 @@
    private Connector connector;
 
    private Future<?> pingerFuture;
-
    private PingRunnable pingRunnable;
 
    private volatile boolean exitLoop;
@@ -984,7 +981,7 @@
                                             " multiplier = " +
                                             retryIntervalMultiplier, new Exception("trace"));
       }
-      
+
       long interval = retryInterval;
 
       int count = 0;
@@ -1070,16 +1067,18 @@
 
    private void cancelScheduledTasks()
    {
-      if (pingerFuture != null)
+      Future<?> pingerFutureLocal = pingerFuture;
+      if (pingerFutureLocal != null)
       {
-         pingRunnable.cancel();
-
-         pingerFuture.cancel(false);
-
-         pingRunnable = null;
-
-         pingerFuture = null;
+         pingerFutureLocal.cancel(false);
       }
+      PingRunnable pingRunnableLocal = pingRunnable;
+      if (pingRunnableLocal != null)
+      {
+         pingRunnableLocal.cancel();
+      }
+      pingerFuture = null;
+      pingRunnable = null;
    }
 
    private void checkCloseConnection()
@@ -1527,7 +1526,7 @@
          }
       }
    }
-   
+
    public class CloseRunnable implements Runnable
    {
       private final CoreRemotingConnection conn;
@@ -1660,7 +1659,7 @@
       }
 
       /**
-       * 
+       *
        */
       public void send()
       {

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionImpl.java	2012-02-17 09:38:02 UTC (rev 12130)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionImpl.java	2012-02-17 10:26:56 UTC (rev 12131)
@@ -84,7 +84,6 @@
 import org.hornetq.core.remoting.FailureListener;
 import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.spi.core.remoting.Connection;
-import org.hornetq.spi.core.remoting.ConnectorFactory;
 import org.hornetq.utils.ConcurrentHashSet;
 import org.hornetq.utils.IDGenerator;
 import org.hornetq.utils.SimpleIDGenerator;



More information about the hornetq-commits mailing list