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%2FDataTreeCohortActorRegistry.java;h=3ff6a9f0e61ba90e7e17a9f2a6b0bf34a7a3a818;hb=55a9b9f42a14c56060f74b38f84d444c0fbfecc4;hp=0e149fa91cc9800e177a3483ae272b2c16d48c10;hpb=0b3bfca7f39ee1bb6dcf5379f44d0b402adeb7fe;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorRegistry.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorRegistry.java index 0e149fa91c..3ff6a9f0e6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorRegistry.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorRegistry.java @@ -5,14 +5,14 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.datastore; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorRef; import akka.actor.PoisonPill; import akka.actor.Status; import akka.util.Timeout; -import com.google.common.base.Preconditions; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import java.util.ArrayList; @@ -20,14 +20,14 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.concurrent.NotThreadSafe; +import java.util.concurrent.Executor; import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; -import org.opendaylight.controller.md.sal.dom.spi.AbstractRegistrationTree; -import org.opendaylight.controller.md.sal.dom.spi.RegistrationTreeNode; -import org.opendaylight.controller.md.sal.dom.spi.RegistrationTreeSnapshot; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMDataTreeCandidate; import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; +import org.opendaylight.mdsal.dom.spi.AbstractRegistrationTree; +import org.opendaylight.mdsal.dom.spi.RegistrationTreeNode; +import org.opendaylight.mdsal.dom.spi.RegistrationTreeSnapshot; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; @@ -39,10 +39,9 @@ import org.slf4j.LoggerFactory; /** * Registry of user commit cohorts, which is responsible for handling registration and calculation - * of affected cohorts based on {@link DataTreeCandidate}. + * of affected cohorts based on {@link DataTreeCandidate}. This class is NOT thread-safe. * */ -@NotThreadSafe class DataTreeCohortActorRegistry extends AbstractRegistrationTree { private static final Logger LOG = LoggerFactory.getLogger(DataTreeCohortActorRegistry.class); @@ -98,11 +97,10 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree { } abstract static class CohortRegistryCommand { - private final ActorRef cohort; CohortRegistryCommand(final ActorRef cohort) { - this.cohort = Preconditions.checkNotNull(cohort); + this.cohort = requireNonNull(cohort); } ActorRef getCohort() { @@ -111,40 +109,34 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree { } static class RegisterCohort extends CohortRegistryCommand { - private final DOMDataTreeIdentifier path; RegisterCohort(final DOMDataTreeIdentifier path, final ActorRef cohort) { super(cohort); this.path = path; - } public DOMDataTreeIdentifier getPath() { return path; } - } static class RemoveCohort extends CohortRegistryCommand { - RemoveCohort(final ActorRef cohort) { super(cohort); } - } private static class CanCommitMessageBuilder { - + private final Multimap actorToCandidates = ArrayListMultimap.create(); private final TransactionIdentifier txId; private final DataTreeCandidate candidate; private final SchemaContext schema; - private final Multimap actorToCandidates = ArrayListMultimap.create(); CanCommitMessageBuilder(final TransactionIdentifier txId, final DataTreeCandidate candidate, final SchemaContext schema) { - this.txId = Preconditions.checkNotNull(txId); - this.candidate = Preconditions.checkNotNull(candidate); + this.txId = requireNonNull(txId); + this.candidate = requireNonNull(candidate); this.schema = schema; } @@ -219,7 +211,7 @@ class DataTreeCohortActorRegistry extends AbstractRegistrationTree { } CompositeDataTreeCohort createCohort(final SchemaContext schemaContext, final TransactionIdentifier txId, - final Timeout commitStepTimeout) { - return new CompositeDataTreeCohort(this, txId, schemaContext, commitStepTimeout); + final Executor callbackExecutor, final Timeout commitStepTimeout) { + return new CompositeDataTreeCohort(this, txId, schemaContext, callbackExecutor, commitStepTimeout); } }