X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShard.java;h=d476b332b30dd35a73e9fe648b718149653cd8fe;hp=eeacdd9b6ffa9cb247c698d64c68936f8e594caa;hb=a3459dc797e4e0722b945b80bc8ef3123762fc8d;hpb=26aad1a330cb5e750f17428e139f4f1c988282ad diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index eeacdd9b6f..d476b332b3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.cluster.datastore; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Verify.verify; +import static com.google.common.base.Verify.verifyNotNull; import static java.util.Objects.requireNonNull; import akka.actor.ActorRef; @@ -151,6 +152,9 @@ public class Shard extends RaftActor { private static final Collection SUPPORTED_ABIVERSIONS; + // Make sure to keep this in sync with the journal configuration in factory-akka.conf + public static final String NON_PERSISTENT_JOURNAL_ID = "akka.persistence.non-persistent.journal"; + static { final ABIVersion[] values = ABIVersion.values(); final ABIVersion[] real = Arrays.copyOfRange(values, 1, values.length - 1); @@ -645,7 +649,7 @@ public class Shard extends RaftActor { } protected void onDatastoreContext(final DatastoreContext context) { - datastoreContext = context; + datastoreContext = verifyNotNull(context); setTransactionCommitTimeout(); @@ -1082,6 +1086,16 @@ public class Shard extends RaftActor { return this.name; } + @Override + public String journalPluginId() { + // This method may be invoked from super constructor (wonderful), hence we also need to handle the case of + // the field being uninitialized because our constructor is not finished. + if (datastoreContext != null && !datastoreContext.isPersistent()) { + return NON_PERSISTENT_JOURNAL_ID; + } + return super.journalPluginId(); + } + @VisibleForTesting ShardCommitCoordinator getCommitCoordinator() { return commitCoordinator;