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;
private static final Collection<ABIVersion> 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);
self(), getContext(), shardMBean, builder.getId().getShardName());
snapshotCohort = ShardSnapshotCohort.create(getContext(), builder.getId().getMemberName(), store, LOG,
- this.name);
+ this.name, datastoreContext);
messageRetrySupport = new ShardTransactionMessageRetrySupport(this);
}
protected void onDatastoreContext(final DatastoreContext context) {
- datastoreContext = context;
+ datastoreContext = verifyNotNull(context);
setTransactionCommitTimeout();
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;