db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oyste...@apache.org
Subject svn commit: r644291 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master: AsynchronousLogShipper.java MasterController.java
Date Thu, 03 Apr 2008 12:45:29 GMT
Author: oysteing
Date: Thu Apr  3 05:45:26 2008
New Revision: 644291

URL: http://svn.apache.org/viewvc?rev=644291&view=rev
Log:
DERBY-3509: The replication log shipper is not notified when a new replication transmitter
is instantiated in MC#handleException.
 - Modified the handleException method to return the transmitter object that is created.
 - The log shipper bases its decision on whether it should continue with the log shipping
based on if a valid transmitter object is created.
Contributed by V Narayanan

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/AsynchronousLogShipper.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/MasterController.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=644291&r1=644290&r2=644291&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
Thu Apr  3 05:45:26 2008
@@ -66,7 +66,7 @@
      * transmission of the log records retrieved from the log buffer
      * (on the master) to the slave being replicated to.
      */
-    final private ReplicationMessageTransmit transmitter;
+    private ReplicationMessageTransmit transmitter;
     
     /**
      * Time interval (in milliseconds) at which the log shipping takes place.
@@ -213,7 +213,14 @@
                 //Interrupt the log shipping thread.
                 return;
             } catch (IOException ioe) {
-                masterController.handleExceptions(ioe);
+                //The transmitter is recreated if the connection to the
+                //slave can be re-established.
+                transmitter = masterController.handleExceptions(ioe);
+                //The transmitter cannot be recreated hence stop the log
+                //shipper thread.
+                if (transmitter != null) {
+                    continue;
+                }
             } catch (StandardException se) {
                 masterController.handleExceptions(se);
             }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/MasterController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/MasterController.java?rev=644291&r1=644290&r2=644291&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/MasterController.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/master/MasterController.java
Thu Apr  3 05:45:26 2008
@@ -503,8 +503,11 @@
      *
      * @param exception the exception which caused the log shipper to terminate
      *                  in an unexcepted manner.
+     *
+     * @return an instance of the transmitter used to transmit messages to the
+     *         slave.
      */
-    void handleExceptions(Exception exception) {
+    ReplicationMessageTransmit handleExceptions(Exception exception) {
         if (exception instanceof IOException) {
             repLogger.logError(MessageId.REPLICATION_LOGSHIPPER_EXCEPTION,
                                exception);
@@ -540,11 +543,14 @@
                     continue;
                 } catch (Exception e) {
                     printStackAndStopMaster(e);
+                    return null;
                 }
             }
         } else if (exception instanceof StandardException) {
             printStackAndStopMaster(exception);
+            return null;
         }
+        return transmitter;
     }
     
     /**



Mime
View raw message