You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by oy...@apache.org on 2008/04/01 14:40:55 UTC

svn commit: r643377 - /db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java

Author: oysteing
Date: Tue Apr  1 05:40:19 2008
New Revision: 643377

URL: http://svn.apache.org/viewvc?rev=643377&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

Merged to 10.4 branch:
svn merge -r642183:642184 https://svn.apache.org/repos/asf/db/derby/code/trunk/



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

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java?rev=643377&r1=643376&r2=643377&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java (original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java Tue Apr  1 05:40:19 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();
             }
         }
     }