db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oyste...@apache.org
Subject svn commit: r642184 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java
Date Fri, 28 Mar 2008 10:29:34 GMT
Author: oysteing
Date: Fri Mar 28 03:29:24 2008
New Revision: 642184

URL: http://svn.apache.org/viewvc?rev=642184&view=rev
Log:
DERBY-3526: AsynchronousLogShipper#workToDo is blocked while the log shipper sends a log chunk
Use a different object to synchronize on while calling wait and notifying the log shipper
thread.
Contributed by V Narayanan

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java?rev=642184&r1=642183&r2=642184&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java
Fri Mar 28 03:29:24 2008
@@ -107,6 +107,12 @@
     private MasterController masterController = null;
     
     /**
+     * Object used to synchronize on while the log shipper thread
+     * is moved into the wait state, or while notifying it.
+     */
+    private Object objLSTSync = new Object(); // LST->Log Shippper Thread
+    
+    /**
      * Store the log chunk that failed during a previous shipping attempt
      * so that it can be re-shipped to the slave.
      */
@@ -197,10 +203,10 @@
                 shipALogChunk();
                 //calculate the shipping interval (wait time) based on the
                 //fill information obtained from the log buffer.
-                synchronized(this) {
-                    shippingInterval = calculateSIfromFI();
-                    if (shippingInterval != -1) {
-                        wait(shippingInterval);
+                shippingInterval = calculateSIfromFI();
+                if (shippingInterval != -1) {
+                    synchronized(objLSTSync) {
+                        objLSTSync.wait(shippingInterval);
                     }
                 }
             } catch (InterruptedException ie) {
@@ -302,11 +308,11 @@
             shipALogChunk();
         }
         
-        synchronized(this) {
+        synchronized(objLSTSync) {
             //There will still be more log to send after the forceFlush
             //has sent one chunk.  Notify the log shipping thread that
             //it is time for another send.
-            notify();
+            objLSTSync.notify();
         }
     }
     
@@ -362,8 +368,8 @@
         if (fi >= FI_HIGH || 
                 (System.currentTimeMillis() - lastShippingTime) >
                  minShippingInterval) {
-            synchronized (this) {
-                notify();
+            synchronized (objLSTSync) {
+                objLSTSync.notify();
             }
         }
     }



Mime
View raw message