package org.opendaylight.mdsal.dom.store.inmemory;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
final InMemoryDOMDataTreeShardChangePublisher changePublisher,
final ListeningExecutorService executor) {
this.producer = producer;
- this.modification = Preconditions.checkNotNull(root);
- this.rootShardDataTree = Preconditions.checkNotNull(rootShardDataTree);
- this.changePublisher = Preconditions.checkNotNull(changePublisher);
+ this.modification = requireNonNull(root);
+ this.rootShardDataTree = requireNonNull(rootShardDataTree);
+ this.changePublisher = requireNonNull(changePublisher);
this.identifier = "INMEMORY-SHARD-TX-" + COUNTER.getAndIncrement();
LOG.debug("Shard transaction{} created", identifier);
this.executor = executor;
}
void cursorClosed() {
- Preconditions.checkNotNull(cursor);
+ requireNonNull(cursor);
modification.closeCursor();
cursor = null;
}
public void ready() {
Preconditions.checkState(!finished, "Attempting to ready an already finished transaction.");
Preconditions.checkState(cursor == null, "Attempting to ready a transaction that has an open cursor.");
- Preconditions.checkNotNull(modification, "Attempting to ready an empty transaction.");
+ requireNonNull(modification, "Attempting to ready an empty transaction.");
LOG.debug("Readying open transaction on shard {}", modification.getPrefix());
rootModification = modification.seal();
public ListenableFuture<Void> submit() {
LOG.debug("Submitting open transaction on shard {}", modification.getPrefix());
- Preconditions.checkNotNull(cohorts);
+ requireNonNull(cohorts);
Preconditions.checkState(!cohorts.isEmpty(), "Transaction was not readied yet.");
return executor.submit(new ShardSubmitCoordinationTask(modification.getPrefix(), cohorts, this));
}
DataTreeModification getRootModification() {
- Preconditions.checkNotNull(rootModification, "Transaction wasn't sealed yet");
+ requireNonNull(rootModification, "Transaction wasn't sealed yet");
return rootModification;
}