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 19646f2..1e08552 100644 (file)
@@ -62,7 +62,7 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
     }
 
     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);
@@ -72,48 +72,48 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
 
         TransactionContext localContext = maybeCreateLocalTransactionContext(parent, shardName);
         if(localContext != null) {
-            transactionContextAdapter.executePriorTransactionOperations(localContext);
+            transactionContextWrapper.executePriorTransactionOperations(localContext);
         } 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,
-            String shardName, TransactionContextWrapper transactionContextAdapter) {
+            String shardName, TransactionContextWrapper transactionContextWrapper) {
         LOG.debug("Tx {}: Find primary for shard {} failed", parent.getIdentifier(), shardName, failure);
 
-        transactionContextAdapter.executePriorTransactionOperations(new NoOpTransactionContext(failure,
+        transactionContextWrapper.executePriorTransactionOperations(new NoOpTransactionContext(failure,
                 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()) {
-                onFindPrimaryShardSuccess(maybe.get(), parent, shardName, transactionContextAdapter);
+                onFindPrimaryShardSuccess(maybe.get(), parent, shardName, transactionContextWrapper);
             } 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) {
-                        onFindPrimaryShardSuccess(primaryShardInfo, parent, shardName, transactionContextAdapter);
+                        onFindPrimaryShardSuccess(primaryShardInfo, parent, shardName, transactionContextWrapper);
                     } else {
-                        onFindPrimaryShardFailure(failure, parent, shardName, transactionContextAdapter);
+                        onFindPrimaryShardFailure(failure, parent, shardName, transactionContextWrapper);
                     }
                 }
             }, actorContext.getClientDispatcher());
         }
 
-        return transactionContextAdapter;
+        return transactionContextWrapper;
     }
 
     private void updateShardInfo(final String shardName, final PrimaryShardInfo primaryShardInfo) {
index 176073e..5920569 100644 (file)
@@ -50,13 +50,13 @@ final class RemoteTransactionContextSupport {
     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;
-        this.transactionContextAdapter = transactionContextAdapter;
+        this.transactionContextWrapper = transactionContextWrapper;
         createTxTries = (int) (parent.getActorContext().getDatastoreContext().
                 getShardLeaderElectionTimeout().duration().toMillis() /
                 CREATE_TX_TRY_INTERVAL.toMillis());
@@ -75,7 +75,7 @@ final class RemoteTransactionContextSupport {
     }
 
     private OperationLimiter getOperationLimiter() {
-        return transactionContextAdapter.getLimiter();
+        return transactionContextWrapper.getLimiter();
     }
 
     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.
-            transactionContextAdapter.executePriorTransactionOperations(createValidTransactionContext(this.primaryShard,
+            transactionContextWrapper.executePriorTransactionOperations(createValidTransactionContext(this.primaryShard,
                     this.primaryShard.path().toString(), primaryVersion));
         } else {
             tryCreateTransaction();
@@ -171,7 +171,7 @@ final class RemoteTransactionContextSupport {
             localTransactionContext = new NoOpTransactionContext(exception, getIdentifier());
         }
 
-        transactionContextAdapter.executePriorTransactionOperations(localTransactionContext);
+        transactionContextWrapper.executePriorTransactionOperations(localTransactionContext);
     }
 
     private TransactionContext createValidTransactionContext(CreateTransactionReply reply) {
@@ -189,11 +189,11 @@ final class RemoteTransactionContextSupport {
         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 {
-            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) {
index f7cb27b..c3a5d07 100644 (file)
@@ -51,7 +51,7 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     }
     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;
@@ -73,8 +73,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         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);
@@ -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();
-        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);
@@ -142,8 +142,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
         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);
@@ -157,8 +157,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
         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);
@@ -172,8 +172,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
 
         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);
@@ -206,8 +206,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
             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();
@@ -216,7 +216,7 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         }
 
 
-        txContextAdapters.clear();
+        txContextWrappers.clear();
     }
 
     @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);
 
-        LOG.debug("Tx {} Readying {} components for commit", getIdentifier(), txContextAdapters.size());
+        LOG.debug("Tx {} Readying {} components for commit", getIdentifier(), txContextWrappers.size());
 
         final AbstractThreePhaseCommitCohort<?> ret;
-        switch (txContextAdapters.size()) {
+        switch (txContextWrappers.size()) {
         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 = createMultiCommitCohort(txContextAdapters.entrySet());
+            ret = createMultiCommitCohort(txContextWrappers.entrySet());
         }
 
         txContextFactory.onTransactionReady(getIdentifier(), ret.getCohortFutures());
@@ -248,18 +248,18 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     }
 
     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);
 
-        final TransactionContext transactionContext = contextAdapter.getTransactionContext();
+        final TransactionContext transactionContext = contextWrapper.getTransactionContext();
         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));
@@ -289,10 +289,10 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
     }
 
     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());
@@ -305,18 +305,18 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         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;
         }
 
-        final TransactionContextWrapper fresh = txContextFactory.newTransactionAdapter(this, shardName);
-        txContextAdapters.put(shardName, fresh);
+        final TransactionContextWrapper fresh = txContextFactory.newTransactionContextWrapper(this, shardName);
+        txContextWrappers.put(shardName, fresh);
         return fresh;
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.