Improve LocalProxyTransaction.doExists()
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / RemoteTransactionContextSupport.java
index 7be72393a2caff1918cd1f8e75bc392feab5290a..b32ef452756ddb689803fda8b4b60c8135cad793 100644 (file)
@@ -34,7 +34,7 @@ import scala.concurrent.duration.FiniteDuration;
  * <p/>
  * The end result from a completed CreateTransaction message is a TransactionContext that is
  * used to perform transaction operations. Transaction operations that occur before the
- * CreateTransaction completes are cache via a TransactionContextWrapper and executed once the
+ * CreateTransaction completes are cached via a DelayedTransactionContextWrapper and executed once the
  * CreateTransaction completes, successfully or not.
  */
 final class RemoteTransactionContextSupport {
@@ -58,9 +58,9 @@ final class RemoteTransactionContextSupport {
 
     private final Timeout createTxMessageTimeout;
 
-    private final TransactionContextWrapper transactionContextWrapper;
+    private final DelayedTransactionContextWrapper transactionContextWrapper;
 
-    RemoteTransactionContextSupport(final TransactionContextWrapper transactionContextWrapper,
+    RemoteTransactionContextSupport(final DelayedTransactionContextWrapper transactionContextWrapper,
             final TransactionProxy parent, final String shardName) {
         this.parent = requireNonNull(parent);
         this.shardName = shardName;
@@ -99,7 +99,7 @@ final class RemoteTransactionContextSupport {
      * Sets the target primary shard and initiates a CreateTransaction try.
      */
     void setPrimaryShard(final PrimaryShardInfo newPrimaryShardInfo) {
-        this.primaryShardInfo = newPrimaryShardInfo;
+        primaryShardInfo = newPrimaryShardInfo;
 
         if (getTransactionType() == TransactionType.WRITE_ONLY
                 && getActorUtils().getDatastoreContext().isWriteOnlyTransactionOptimizationsEnabled()) {
@@ -130,7 +130,7 @@ final class RemoteTransactionContextSupport {
         Future<Object> createTxFuture = getActorUtils().executeOperationAsync(
                 primaryShardInfo.getPrimaryShardActor(), serializedCreateMessage, createTxMessageTimeout);
 
-        createTxFuture.onComplete(new OnComplete<Object>() {
+        createTxFuture.onComplete(new OnComplete<>() {
             @Override
             public void onComplete(final Throwable failure, final Object response) {
                 onCreateTransactionComplete(failure, response);
@@ -141,7 +141,7 @@ final class RemoteTransactionContextSupport {
     private void tryFindPrimaryShard() {
         LOG.debug("Tx {} Retrying findPrimaryShardAsync for shard {}", getIdentifier(), shardName);
 
-        this.primaryShardInfo = null;
+        primaryShardInfo = null;
         Future<PrimaryShardInfo> findPrimaryFuture = getActorUtils().findPrimaryShardAsync(shardName);
         findPrimaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
             @Override
@@ -153,7 +153,7 @@ final class RemoteTransactionContextSupport {
 
     private void onFindPrimaryShardComplete(final Throwable failure, final PrimaryShardInfo newPrimaryShardInfo) {
         if (failure == null) {
-            this.primaryShardInfo = newPrimaryShardInfo;
+            primaryShardInfo = newPrimaryShardInfo;
             tryCreateTransaction();
         } else {
             LOG.debug("Tx {}: Find primary for shard {} failed", getIdentifier(), shardName, failure);
@@ -228,7 +228,6 @@ final class RemoteTransactionContextSupport {
 
             localTransactionContext = new NoOpTransactionContext(exception, getIdentifier());
         }
-
         transactionContextWrapper.executePriorTransactionOperations(localTransactionContext);
     }