package org.opendaylight.mdsal.dom.store.inmemory;
+import com.google.common.annotations.Beta;
+import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-class ShardCanCommitCoordinationTask implements Callable<Boolean> {
+/**
+ * Task that coordinates the CanCommit phase of the provided {@link DOMStoreThreePhaseCommitCohort}'s
+ */
+@Beta
+public class ShardCanCommitCoordinationTask implements Callable<Boolean> {
private static final Logger LOG = LoggerFactory.getLogger(ShardCanCommitCoordinationTask.class);
private final DOMDataTreeIdentifier rootShardPrefix;
private final Collection<DOMStoreThreePhaseCommitCohort> cohorts;
- ShardCanCommitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
+ public ShardCanCommitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
- this.rootShardPrefix = rootShardPrefix;
- this.cohorts = cohorts;
+ this.rootShardPrefix = Preconditions.checkNotNull(rootShardPrefix);
+ this.cohorts = Preconditions.checkNotNull(cohorts);
}
@Override
canCommitBlocking();
return true;
- } catch (TransactionCommitFailedException e) {
+ } catch (final TransactionCommitFailedException e) {
LOG.warn("Shard: {} Submit Error during phase CanCommit, starting Abort", rootShardPrefix, e);
//FIXME abort here
throw e;
package org.opendaylight.mdsal.dom.store.inmemory;
+import com.google.common.annotations.Beta;
+import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-class ShardCommitCoordinationTask implements Callable<Void> {
+/**
+ * Task that coordinates the Commit phase of the provided {@link DOMStoreThreePhaseCommitCohort}'s
+ */
+@Beta
+public class ShardCommitCoordinationTask implements Callable<Void> {
private static final Logger LOG = LoggerFactory.getLogger(ShardCommitCoordinationTask.class);
private final DOMDataTreeIdentifier rootShardPrefix;
private final Collection<DOMStoreThreePhaseCommitCohort> cohorts;
- ShardCommitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
+ public ShardCommitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
- this.rootShardPrefix = rootShardPrefix;
- this.cohorts = cohorts;
+ this.rootShardPrefix = Preconditions.checkNotNull(rootShardPrefix);
+ this.cohorts = Preconditions.checkNotNull(cohorts);
}
@Override
commitBlocking();
return null;
- } catch (TransactionCommitFailedException e) {
+ } catch (final TransactionCommitFailedException e) {
LOG.warn("Shard: {} Submit Error during phase Commit, starting Abort", rootShardPrefix, e);
//FIXME abort here
throw e;
package org.opendaylight.mdsal.dom.store.inmemory;
+import com.google.common.annotations.Beta;
+import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-class ShardPreCommitCoordinationTask implements Callable<Void>{
+/**
+ * Task that coordinates the PreCommit phase of the provided {@link DOMStoreThreePhaseCommitCohort}'s
+ */
+@Beta
+public class ShardPreCommitCoordinationTask implements Callable<Void>{
private static final Logger LOG = LoggerFactory.getLogger(ShardPreCommitCoordinationTask.class);
private final DOMDataTreeIdentifier rootShardPrefix;
private final Collection<DOMStoreThreePhaseCommitCohort> cohorts;
- ShardPreCommitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
+ public ShardPreCommitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
- this.rootShardPrefix = rootShardPrefix;
- this.cohorts = cohorts;
+ this.rootShardPrefix = Preconditions.checkNotNull(rootShardPrefix);
+ this.cohorts = Preconditions.checkNotNull(cohorts);
}
@Override
preCommitBlocking();
return null;
- } catch (TransactionCommitFailedException e) {
+ } catch (final TransactionCommitFailedException e) {
LOG.warn("Shard: {} Submit Error during phase {}, starting Abort", rootShardPrefix, e);
//FIXME abort here
throw e;
package org.opendaylight.mdsal.dom.store.inmemory;
+import com.google.common.annotations.Beta;
+import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-class ShardSubmitCoordinationTask implements Callable<Void> {
+/**
+ * Task that coordinates all phases of transaction submit from the provided {@link DOMStoreThreePhaseCommitCohort}'s.
+ * Each phase will only be started once all cohorts have finished the previous phase.
+ */
+@Beta
+public class ShardSubmitCoordinationTask implements Callable<Void> {
private static final Logger LOG = LoggerFactory.getLogger(ShardSubmitCoordinationTask.class);
private final ShardCommitCoordinationTask commitCoordinationTask;
- ShardSubmitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
+ public ShardSubmitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
- this.rootShardPrefix = rootShardPrefix;
+ this.rootShardPrefix = Preconditions.checkNotNull(rootShardPrefix);
canCommitCoordinationTask = new ShardCanCommitCoordinationTask(rootShardPrefix, cohorts);
preCommitCoordinationTask = new ShardPreCommitCoordinationTask(rootShardPrefix, cohorts);