Change variables, methods, field names from transactionContextAdapter to transactionC... 82/22382/1
authorMoiz Raja <moraja@cisco.com>
Wed, 10 Jun 2015 18:33:00 +0000 (11:33 -0700)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 11 Jun 2015 17:19:10 +0000 (17:19 +0000)
Change-Id: I675df3d3c5ace1fcb4b82025e862eafa8cc37357
Signed-off-by: Moiz Raja <moraja@cisco.com>
(cherry picked from commit 080a1841e19ede9fd9c098d2e1350e0b618ac9f1)

opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContextFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java

index 19646f27fc9a1f42fbbd716dce0f0e721ad0ef0a..1e085523fdc0599e21a320e4d721abdba9bd13a1 100644 (file)
@@ -62,7 +62,7 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
     }
 
     private void onFindPrimaryShardSuccess(PrimaryShardInfo primaryShardInfo, TransactionProxy parent,
     }
 
     private void onFindPrimaryShardSuccess(PrimaryShardInfo primaryShardInfo, TransactionProxy parent,
-            String shardName, TransactionContextWrapper transactionContextAdapter) {
+            String shardName, TransactionContextWrapper transactionContextWrapper) {
         if(LOG.isDebugEnabled()) {
             LOG.debug("Tx {}: Found primary {} for shard {}", parent.getIdentifier(),
                     primaryShardInfo.getPrimaryShardActor(), shardName);
         if(LOG.isDebugEnabled()) {
             LOG.debug("Tx {}: Found primary {} for shard {}", parent.getIdentifier(),
                     primaryShardInfo.getPrimaryShardActor(), shardName);
@@ -72,48 +72,48 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
 
         TransactionContext localContext = maybeCreateLocalTransactionContext(parent, shardName);
         if(localContext != null) {
 
         TransactionContext localContext = maybeCreateLocalTransactionContext(parent, shardName);
         if(localContext != null) {
-            transactionContextAdapter.executePriorTransactionOperations(localContext);
+            transactionContextWrapper.executePriorTransactionOperations(localContext);
         } else {
         } else {
-            RemoteTransactionContextSupport remote = new RemoteTransactionContextSupport(transactionContextAdapter,
+            RemoteTransactionContextSupport remote = new RemoteTransactionContextSupport(transactionContextWrapper,
                     parent, shardName);
             remote.setPrimaryShard(primaryShardInfo.getPrimaryShardActor(), primaryShardInfo.getPrimaryShardVersion());
         }
     }
 
     private void onFindPrimaryShardFailure(Throwable failure, TransactionProxy parent,
                     parent, shardName);
             remote.setPrimaryShard(primaryShardInfo.getPrimaryShardActor(), primaryShardInfo.getPrimaryShardVersion());
         }
     }
 
     private void onFindPrimaryShardFailure(Throwable failure, TransactionProxy parent,
-            String shardName, TransactionContextWrapper transactionContextAdapter) {
+            String shardName, TransactionContextWrapper transactionContextWrapper) {
         LOG.debug("Tx {}: Find primary for shard {} failed", parent.getIdentifier(), shardName, failure);
 
         LOG.debug("Tx {}: Find primary for shard {} failed", parent.getIdentifier(), shardName, failure);
 
-        transactionContextAdapter.executePriorTransactionOperations(new NoOpTransactionContext(failure,
+        transactionContextWrapper.executePriorTransactionOperations(new NoOpTransactionContext(failure,
                 parent.getIdentifier()));
     }
 
                 parent.getIdentifier()));
     }
 
-    final TransactionContextWrapper newTransactionAdapter(final TransactionProxy parent, final String shardName) {
-        final TransactionContextWrapper transactionContextAdapter =
+    final TransactionContextWrapper newTransactionContextWrapper(final TransactionProxy parent, final String shardName) {
+        final TransactionContextWrapper transactionContextWrapper =
                 new TransactionContextWrapper(parent.getIdentifier(), actorContext);
 
         Future<PrimaryShardInfo> findPrimaryFuture = findPrimaryShard(shardName);
         if(findPrimaryFuture.isCompleted()) {
             Try<PrimaryShardInfo> maybe = findPrimaryFuture.value().get();
             if(maybe.isSuccess()) {
                 new TransactionContextWrapper(parent.getIdentifier(), actorContext);
 
         Future<PrimaryShardInfo> findPrimaryFuture = findPrimaryShard(shardName);
         if(findPrimaryFuture.isCompleted()) {
             Try<PrimaryShardInfo> maybe = findPrimaryFuture.value().get();
             if(maybe.isSuccess()) {
-                onFindPrimaryShardSuccess(maybe.get(), parent, shardName, transactionContextAdapter);
+                onFindPrimaryShardSuccess(maybe.get(), parent, shardName, transactionContextWrapper);
             } else {
             } else {
-                onFindPrimaryShardFailure(maybe.failed().get(), parent, shardName, transactionContextAdapter);
+                onFindPrimaryShardFailure(maybe.failed().get(), parent, shardName, transactionContextWrapper);
             }
         } else {
             findPrimaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
                 @Override
                 public void onComplete(final Throwable failure, final PrimaryShardInfo primaryShardInfo) {
                     if (failure == null) {
             }
         } else {
             findPrimaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
                 @Override
                 public void onComplete(final Throwable failure, final PrimaryShardInfo primaryShardInfo) {
                     if (failure == null) {
-                        onFindPrimaryShardSuccess(primaryShardInfo, parent, shardName, transactionContextAdapter);
+                        onFindPrimaryShardSuccess(primaryShardInfo, parent, shardName, transactionContextWrapper);
                     } else {
                     } else {
-                        onFindPrimaryShardFailure(failure, parent, shardName, transactionContextAdapter);
+                        onFindPrimaryShardFailure(failure, parent, shardName, transactionContextWrapper);
                     }
                 }
             }, actorContext.getClientDispatcher());
         }
 
                     }
                 }
             }, actorContext.getClientDispatcher());
         }
 
-        return transactionContextAdapter;
+        return transactionContextWrapper;
     }
 
     private void updateShardInfo(final String shardName, final PrimaryShardInfo primaryShardInfo) {
     }
 
     private void updateShardInfo(final String shardName, final PrimaryShardInfo primaryShardInfo) {
index 176073ef705cdcd38d714d395f07988fd060b4e9..59205692d119ffc9183a7c505f39c43008ea28db 100644 (file)
@@ -50,13 +50,13 @@ final class RemoteTransactionContextSupport {
     private volatile ActorSelection primaryShard;
     private volatile int createTxTries;
 
     private volatile ActorSelection primaryShard;
     private volatile int createTxTries;
 
-    private final TransactionContextWrapper transactionContextAdapter;
+    private final TransactionContextWrapper transactionContextWrapper;
 
 
-    RemoteTransactionContextSupport(final TransactionContextWrapper transactionContextAdapter, final TransactionProxy parent,
+    RemoteTransactionContextSupport(final TransactionContextWrapper transactionContextWrapper, final TransactionProxy parent,
             final String shardName) {
         this.parent = Preconditions.checkNotNull(parent);
         this.shardName = shardName;
             final String shardName) {
         this.parent = Preconditions.checkNotNull(parent);
         this.shardName = shardName;
-        this.transactionContextAdapter = transactionContextAdapter;
+        this.transactionContextWrapper = transactionContextWrapper;
         createTxTries = (int) (parent.getActorContext().getDatastoreContext().
                 getShardLeaderElectionTimeout().duration().toMillis() /
                 CREATE_TX_TRY_INTERVAL.toMillis());
         createTxTries = (int) (parent.getActorContext().getDatastoreContext().
                 getShardLeaderElectionTimeout().duration().toMillis() /
                 CREATE_TX_TRY_INTERVAL.toMillis());
@@ -75,7 +75,7 @@ final class RemoteTransactionContextSupport {
     }
 
     private OperationLimiter getOperationLimiter() {
     }
 
     private OperationLimiter getOperationLimiter() {
-        return transactionContextAdapter.getLimiter();
+        return transactionContextWrapper.getLimiter();
     }
 
     private TransactionIdentifier getIdentifier() {
     }
 
     private TransactionIdentifier getIdentifier() {
@@ -95,7 +95,7 @@ final class RemoteTransactionContextSupport {
 
             // For write-only Tx's we prepare the transaction modifications directly on the shard actor
             // to avoid the overhead of creating a separate transaction actor.
 
             // For write-only Tx's we prepare the transaction modifications directly on the shard actor
             // to avoid the overhead of creating a separate transaction actor.
-            transactionContextAdapter.executePriorTransactionOperations(createValidTransactionContext(this.primaryShard,
+            transactionContextWrapper.executePriorTransactionOperations(createValidTransactionContext(this.primaryShard,
                     this.primaryShard.path().toString(), primaryVersion));
         } else {
             tryCreateTransaction();
                     this.primaryShard.path().toString(), primaryVersion));
         } else {
             tryCreateTransaction();
@@ -171,7 +171,7 @@ final class RemoteTransactionContextSupport {
             localTransactionContext = new NoOpTransactionContext(exception, getIdentifier());
         }
 
             localTransactionContext = new NoOpTransactionContext(exception, getIdentifier());
         }
 
-        transactionContextAdapter.executePriorTransactionOperations(localTransactionContext);
+        transactionContextWrapper.executePriorTransactionOperations(localTransactionContext);
     }
 
     private TransactionContext createValidTransactionContext(CreateTransactionReply reply) {
     }
 
     private TransactionContext createValidTransactionContext(CreateTransactionReply reply) {
@@ -189,11 +189,11 @@ final class RemoteTransactionContextSupport {
         final TransactionContext ret;
 
         if (remoteTransactionVersion < DataStoreVersions.LITHIUM_VERSION) {
         final TransactionContext ret;
 
         if (remoteTransactionVersion < DataStoreVersions.LITHIUM_VERSION) {
-            ret = new PreLithiumTransactionContextImpl(transactionContextAdapter.getIdentifier(), transactionPath, transactionActor,
-                getActorContext(), isTxActorLocal, remoteTransactionVersion, transactionContextAdapter.getLimiter());
+            ret = new PreLithiumTransactionContextImpl(transactionContextWrapper.getIdentifier(), transactionPath, transactionActor,
+                getActorContext(), isTxActorLocal, remoteTransactionVersion, transactionContextWrapper.getLimiter());
         } else {
         } else {
-            ret = new RemoteTransactionContext(transactionContextAdapter.getIdentifier(), transactionActor, getActorContext(),
-                isTxActorLocal, remoteTransactionVersion, transactionContextAdapter.getLimiter());
+            ret = new RemoteTransactionContext(transactionContextWrapper.getIdentifier(), transactionActor, getActorContext(),
+                isTxActorLocal, remoteTransactionVersion, transactionContextWrapper.getLimiter());
         }
 
         if(parent.getType() == TransactionType.READ_ONLY) {
         }
 
         if(parent.getType() == TransactionType.READ_ONLY) {
index f7cb27b07f2c139c857e2c9308372678e7c29afd..c3a5d074140785626828c0d6eebaf18709ed5bbc 100644 (file)
@@ -51,7 +51,7 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     }
     private static final Logger LOG = LoggerFactory.getLogger(TransactionProxy.class);
 
     }
     private static final Logger LOG = LoggerFactory.getLogger(TransactionProxy.class);
 
-    private final Map<String, TransactionContextWrapper> txContextAdapters = new HashMap<>();
+    private final Map<String, TransactionContextWrapper> txContextWrappers = new HashMap<>();
     private final AbstractTransactionContextFactory<?> txContextFactory;
     private final TransactionType type;
     private TransactionState state = TransactionState.OPEN;
     private final AbstractTransactionContextFactory<?> txContextFactory;
     private final TransactionType type;
     private TransactionState state = TransactionState.OPEN;
@@ -73,8 +73,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         LOG.debug("Tx {} exists {}", getIdentifier(), path);
 
         final SettableFuture<Boolean> proxyFuture = SettableFuture.create();
         LOG.debug("Tx {} exists {}", getIdentifier(), path);
 
         final SettableFuture<Boolean> proxyFuture = SettableFuture.create();
-        TransactionContextWrapper contextAdapter = getContextAdapter(path);
-        contextAdapter.maybeExecuteTransactionOperation(new TransactionOperation() {
+        TransactionContextWrapper contextWrapper = getContextWrapper(path);
+        contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.dataExists(path, proxyFuture);
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.dataExists(path, proxyFuture);
@@ -100,8 +100,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     private CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> singleShardRead(
             final String shardName, final YangInstanceIdentifier path) {
         final SettableFuture<Optional<NormalizedNode<?, ?>>> proxyFuture = SettableFuture.create();
     private CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> singleShardRead(
             final String shardName, final YangInstanceIdentifier path) {
         final SettableFuture<Optional<NormalizedNode<?, ?>>> proxyFuture = SettableFuture.create();
-        TransactionContextWrapper contextAdapter = getContextAdapter(shardName);
-        contextAdapter.maybeExecuteTransactionOperation(new TransactionOperation() {
+        TransactionContextWrapper contextWrapper = getContextWrapper(shardName);
+        contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.readData(path, proxyFuture);
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.readData(path, proxyFuture);
@@ -142,8 +142,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
         LOG.debug("Tx {} delete {}", getIdentifier(), path);
 
 
         LOG.debug("Tx {} delete {}", getIdentifier(), path);
 
-        TransactionContextWrapper contextAdapter = getContextAdapter(path);
-        contextAdapter.maybeExecuteTransactionOperation(new TransactionOperation() {
+        TransactionContextWrapper contextWrapper = getContextWrapper(path);
+        contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.deleteData(path);
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.deleteData(path);
@@ -157,8 +157,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
         LOG.debug("Tx {} merge {}", getIdentifier(), path);
 
 
         LOG.debug("Tx {} merge {}", getIdentifier(), path);
 
-        TransactionContextWrapper contextAdapter = getContextAdapter(path);
-        contextAdapter.maybeExecuteTransactionOperation(new TransactionOperation() {
+        TransactionContextWrapper contextWrapper = getContextWrapper(path);
+        contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.mergeData(path, data);
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.mergeData(path, data);
@@ -172,8 +172,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
         LOG.debug("Tx {} write {}", getIdentifier(), path);
 
 
         LOG.debug("Tx {} write {}", getIdentifier(), path);
 
-        TransactionContextWrapper contextAdapter = getContextAdapter(path);
-        contextAdapter.maybeExecuteTransactionOperation(new TransactionOperation() {
+        TransactionContextWrapper contextWrapper = getContextWrapper(path);
+        contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.writeData(path, data);
             @Override
             public void invoke(TransactionContext transactionContext) {
                 transactionContext.writeData(path, data);
@@ -206,8 +206,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
             return;
         }
 
             return;
         }
 
-        for (TransactionContextWrapper contextAdapter : txContextAdapters.values()) {
-            contextAdapter.maybeExecuteTransactionOperation(new TransactionOperation() {
+        for (TransactionContextWrapper contextWrapper : txContextWrappers.values()) {
+            contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
                 @Override
                 public void invoke(TransactionContext transactionContext) {
                     transactionContext.closeTransaction();
                 @Override
                 public void invoke(TransactionContext transactionContext) {
                     transactionContext.closeTransaction();
@@ -216,7 +216,7 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         }
 
 
         }
 
 
-        txContextAdapters.clear();
+        txContextWrappers.clear();
     }
 
     @Override
     }
 
     @Override
@@ -226,19 +226,19 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         final boolean success = seal(TransactionState.READY);
         Preconditions.checkState(success, "Transaction %s is %s, it cannot be readied", getIdentifier(), state);
 
         final boolean success = seal(TransactionState.READY);
         Preconditions.checkState(success, "Transaction %s is %s, it cannot be readied", getIdentifier(), state);
 
-        LOG.debug("Tx {} Readying {} components for commit", getIdentifier(), txContextAdapters.size());
+        LOG.debug("Tx {} Readying {} components for commit", getIdentifier(), txContextWrappers.size());
 
         final AbstractThreePhaseCommitCohort<?> ret;
 
         final AbstractThreePhaseCommitCohort<?> ret;
-        switch (txContextAdapters.size()) {
+        switch (txContextWrappers.size()) {
         case 0:
             ret = NoOpDOMStoreThreePhaseCommitCohort.INSTANCE;
             break;
         case 1:
         case 0:
             ret = NoOpDOMStoreThreePhaseCommitCohort.INSTANCE;
             break;
         case 1:
-            final Entry<String, TransactionContextWrapper> e = Iterables.getOnlyElement(txContextAdapters.entrySet());
+            final Entry<String, TransactionContextWrapper> e = Iterables.getOnlyElement(txContextWrappers.entrySet());
             ret = createSingleCommitCohort(e.getKey(), e.getValue());
             break;
         default:
             ret = createSingleCommitCohort(e.getKey(), e.getValue());
             break;
         default:
-            ret = createMultiCommitCohort(txContextAdapters.entrySet());
+            ret = createMultiCommitCohort(txContextWrappers.entrySet());
         }
 
         txContextFactory.onTransactionReady(getIdentifier(), ret.getCohortFutures());
         }
 
         txContextFactory.onTransactionReady(getIdentifier(), ret.getCohortFutures());
@@ -248,18 +248,18 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     }
 
     private AbstractThreePhaseCommitCohort<?> createSingleCommitCohort(final String shardName,
     }
 
     private AbstractThreePhaseCommitCohort<?> createSingleCommitCohort(final String shardName,
-            final TransactionContextWrapper contextAdapter) {
+            final TransactionContextWrapper contextWrapper) {
 
         LOG.debug("Tx {} Readying transaction for shard {}", getIdentifier(), shardName);
 
         final OperationCallback.Reference operationCallbackRef =
                 new OperationCallback.Reference(OperationCallback.NO_OP_CALLBACK);
 
 
         LOG.debug("Tx {} Readying transaction for shard {}", getIdentifier(), shardName);
 
         final OperationCallback.Reference operationCallbackRef =
                 new OperationCallback.Reference(OperationCallback.NO_OP_CALLBACK);
 
-        final TransactionContext transactionContext = contextAdapter.getTransactionContext();
+        final TransactionContext transactionContext = contextWrapper.getTransactionContext();
         final Future future;
         if (transactionContext == null) {
             final Promise promise = akka.dispatch.Futures.promise();
         final Future future;
         if (transactionContext == null) {
             final Promise promise = akka.dispatch.Futures.promise();
-            contextAdapter.maybeExecuteTransactionOperation(new TransactionOperation() {
+            contextWrapper.maybeExecuteTransactionOperation(new TransactionOperation() {
                 @Override
                 public void invoke(TransactionContext transactionContext) {
                     promise.completeWith(getReadyOrDirectCommitFuture(transactionContext, operationCallbackRef));
                 @Override
                 public void invoke(TransactionContext transactionContext) {
                     promise.completeWith(getReadyOrDirectCommitFuture(transactionContext, operationCallbackRef));
@@ -289,10 +289,10 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     }
 
     private AbstractThreePhaseCommitCohort<ActorSelection> createMultiCommitCohort(
     }
 
     private AbstractThreePhaseCommitCohort<ActorSelection> createMultiCommitCohort(
-            final Set<Entry<String, TransactionContextWrapper>> txContextAdapterEntries) {
+            final Set<Entry<String, TransactionContextWrapper>> txContextWrapperEntries) {
 
 
-        final List<Future<ActorSelection>> cohortFutures = new ArrayList<>(txContextAdapterEntries.size());
-        for (Entry<String, TransactionContextWrapper> e : txContextAdapterEntries) {
+        final List<Future<ActorSelection>> cohortFutures = new ArrayList<>(txContextWrapperEntries.size());
+        for (Entry<String, TransactionContextWrapper> e : txContextWrapperEntries) {
             LOG.debug("Tx {} Readying transaction for shard {}", getIdentifier(), e.getKey());
 
             cohortFutures.add(e.getValue().readyTransaction());
             LOG.debug("Tx {} Readying transaction for shard {}", getIdentifier(), e.getKey());
 
             cohortFutures.add(e.getValue().readyTransaction());
@@ -305,18 +305,18 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         return ShardStrategyFactory.getStrategy(path).findShard(path);
     }
 
         return ShardStrategyFactory.getStrategy(path).findShard(path);
     }
 
-    private TransactionContextWrapper getContextAdapter(final YangInstanceIdentifier path) {
-        return getContextAdapter(shardNameFromIdentifier(path));
+    private TransactionContextWrapper getContextWrapper(final YangInstanceIdentifier path) {
+        return getContextWrapper(shardNameFromIdentifier(path));
     }
 
     }
 
-    private TransactionContextWrapper getContextAdapter(final String shardName) {
-        final TransactionContextWrapper existing = txContextAdapters.get(shardName);
+    private TransactionContextWrapper getContextWrapper(final String shardName) {
+        final TransactionContextWrapper existing = txContextWrappers.get(shardName);
         if (existing != null) {
             return existing;
         }
 
         if (existing != null) {
             return existing;
         }
 
-        final TransactionContextWrapper fresh = txContextFactory.newTransactionAdapter(this, shardName);
-        txContextAdapters.put(shardName, fresh);
+        final TransactionContextWrapper fresh = txContextFactory.newTransactionContextWrapper(this, shardName);
+        txContextWrappers.put(shardName, fresh);
         return fresh;
     }
 
         return fresh;
     }