Handle ModifyTransactionRequest in forward path
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / actors / dds / LocalReadWriteProxyTransaction.java
index 9fa8ac7c42748e3f464ce86e85dbe2694f60d1df..be3de3a19734774f3473c879ce41a8edc5dab990 100644 (file)
@@ -86,13 +86,13 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
     LocalReadWriteProxyTransaction(final ProxyHistory parent, final TransactionIdentifier identifier,
         final DataTreeSnapshot snapshot) {
         super(parent, identifier, false);
-        this.modification = (CursorAwareDataTreeModification) snapshot.newModification();
+        modification = (CursorAwareDataTreeModification) snapshot.newModification();
     }
 
     LocalReadWriteProxyTransaction(final ProxyHistory parent, final TransactionIdentifier identifier) {
         super(parent, identifier, true);
         // This is DONE transaction, this should never be touched
-        this.modification = null;
+        modification = null;
     }
 
     @Override
@@ -325,12 +325,19 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
     void forwardToLocal(final LocalProxyTransaction successor, final TransactionRequest<?> request,
             final Consumer<Response<?, ?>> callback) {
         if (request instanceof CommitLocalTransactionRequest) {
-            Verify.verify(successor instanceof LocalReadWriteProxyTransaction);
-            ((LocalReadWriteProxyTransaction) successor).sendRebased((CommitLocalTransactionRequest)request, callback);
-            LOG.debug("Forwarded request {} to successor {}", request, successor);
+            verifyLocalReadWrite(successor).sendRebased((CommitLocalTransactionRequest)request, callback);
+        } else if (request instanceof ModifyTransactionRequest) {
+            verifyLocalReadWrite(successor).handleForwardedRemoteRequest(request, callback);
         } else {
             super.forwardToLocal(successor, request, callback);
+            return;
         }
+        LOG.debug("Forwarded request {} to successor {}", request, successor);
+    }
+
+    private static LocalReadWriteProxyTransaction verifyLocalReadWrite(final LocalProxyTransaction successor) {
+        Verify.verify(successor instanceof LocalReadWriteProxyTransaction, "Unexpected successor %s", successor);
+        return (LocalReadWriteProxyTransaction) successor;
     }
 
     @Override