X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractTransactionContext.java;h=97a0205ff2b7bc1a94bfe88c23e26a642b2a0866;hb=87c8362c7501408b281f5ddc9b78ed7440280fa1;hp=571899ba14343f7b8f189571e18f708b397fc86b;hpb=d71b6614d6cdb5a98f086edeb56f5c52f365c61c;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContext.java index 571899ba14..97a0205ff2 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContext.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContext.java @@ -7,7 +7,6 @@ */ package org.opendaylight.controller.cluster.datastore; -import com.google.common.base.Preconditions; import javax.annotation.Nonnull; import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier; import org.slf4j.Logger; @@ -15,12 +14,12 @@ import org.slf4j.LoggerFactory; abstract class AbstractTransactionContext implements TransactionContext { private static final Logger LOG = LoggerFactory.getLogger(AbstractTransactionContext.class); - private final OperationLimiter limiter; + private final TransactionIdentifier transactionIdentifier; private long modificationCount = 0; - private boolean handoffComplete; + private boolean handOffComplete; - protected AbstractTransactionContext(final OperationLimiter limiter) { - this.limiter = Preconditions.checkNotNull(limiter); + protected AbstractTransactionContext(TransactionIdentifier transactionIdentifier) { + this.transactionIdentifier = transactionIdentifier; } /** @@ -29,44 +28,7 @@ abstract class AbstractTransactionContext implements TransactionContext { * @return Transaction identifier. */ @Nonnull protected final TransactionIdentifier getIdentifier() { - return limiter.getIdentifier(); - } - - /** - * Return the operation limiter associated with this context. - * @return Operation limiter. - */ - @Nonnull protected final OperationLimiter getLimiter() { - return limiter; - } - - /** - * Indicate whether all operations have been handed off by the {@link TransactionContextWrapper}. - * - * @return True if this context is responsible for throttling. - */ - protected final boolean isOperationHandoffComplete() { - return handoffComplete; - } - - /** - * Acquire operation from the limiter if the handoff has completed. If - * the handoff is still ongoing, this method does nothing. - */ - protected final void acquireOperation() { - if (handoffComplete) { - limiter.acquire(); - } - } - - /** - * Acquire operation from the limiter if the handoff has NOT completed. If - * the handoff has completed, this method does nothing. - */ - protected final void releaseOperation() { - if (!handoffComplete) { - limiter.release(); - } + return transactionIdentifier; } protected final void incrementModificationCount() { @@ -78,7 +40,16 @@ abstract class AbstractTransactionContext implements TransactionContext { } @Override - public final void operationHandoffComplete() { - handoffComplete = true; + public final void operationHandOffComplete() { + handOffComplete = true; + } + + protected boolean isOperationHandOffComplete(){ + return handOffComplete; + } + + @Override + public boolean usesOperationLimiting() { + return false; } }