[hornetq-commits] JBoss hornetq SVN: r12242 - trunk/hornetq-core/src/main/java/org/hornetq/core/replication.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Mar 6 06:39:29 EST 2012


Author: borges
Date: 2012-03-06 06:39:28 -0500 (Tue, 06 Mar 2012)
New Revision: 12242

Modified:
   trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java
Log:
HORNETQ-720 Remove "stopLock" and move finishSynchronization(int) inside the synchronized block

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java	2012-03-05 20:57:36 UTC (rev 12241)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java	2012-03-06 11:39:28 UTC (rev 12242)
@@ -75,7 +75,7 @@
 /**
  * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
  */
-public class ReplicationEndpoint implements ChannelHandler, HornetQComponent
+public final class ReplicationEndpoint implements ChannelHandler, HornetQComponent
 {
 
    // Constants -----------------------------------------------------
@@ -120,9 +120,6 @@
 
    private QuorumManager quorumManager;
 
-   //https://community.jboss.org/thread/195519
-   private final Object stopLock = new Object();
-
    // Constructors --------------------------------------------------
    public ReplicationEndpoint(final HornetQServerImpl server, IOCriticalErrorListener criticalErrorListener)
    {
@@ -159,8 +156,6 @@
 
       try
       {
-         synchronized (stopLock)
-         {
             if (!started)
             {
                return;
@@ -230,7 +225,6 @@
          else
          {
             log.warn("Packet " + packet + " can't be processed by the ReplicationEndpoint");
-            }
          }
       }
       catch (HornetQException e)
@@ -303,8 +297,6 @@
 
    public synchronized void stop() throws Exception
    {
-      synchronized (stopLock)
-      {
          if (!started)
          {
             return;
@@ -364,7 +356,6 @@
          storage.stop();
 
          started = false;
-      }
    }
 
 
@@ -482,6 +473,11 @@
       return;
    }
 
+   /**
+    * Receives 'raw' journal/page/large-message data from live server for synchronization of logs.
+    * @param msg
+    * @throws Exception
+    */
    private synchronized void handleReplicationSynchronization(ReplicationSyncFileMessage msg) throws Exception
    {
       Long id = Long.valueOf(msg.getId());
@@ -549,17 +545,18 @@
          throw new HornetQException(HornetQException.INTERNAL_ERROR, "RemoteBackup can not be up-to-date!");
       }
 
-      if (packet.isSynchronizationFinished())
-      {
-         finishSynchronization(packet.getNodeID());
-         return;
-      }
 
-
       synchronized (this)
       {
          if (!started)
             return;
+
+         if (packet.isSynchronizationFinished())
+         {
+            finishSynchronization(packet.getNodeID());
+            return;
+         }
+
          switch (packet.getDataType())
          {
             case LargeMessages:



More information about the hornetq-commits mailing list