These will be reused in controller so make them public.
Change-Id: I89fb776768d8e975fd744fd1daefc2d0bb3eaa3f
Signed-off-by: Tomas Cere <tcere@cisco.com>
(cherry picked from commit
6a8c4d89d24cb6a819949b3782965f2cde1d20fe)
package org.opendaylight.mdsal.dom.store.inmemory;
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 com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
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) {
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
- this.rootShardPrefix = rootShardPrefix;
- this.cohorts = cohorts;
+ this.rootShardPrefix = Preconditions.checkNotNull(rootShardPrefix);
+ this.cohorts = Preconditions.checkNotNull(cohorts);
canCommitBlocking();
return true;
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;
LOG.warn("Shard: {} Submit Error during phase CanCommit, starting Abort", rootShardPrefix, e);
//FIXME abort here
throw e;
package org.opendaylight.mdsal.dom.store.inmemory;
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 com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
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) {
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
- this.rootShardPrefix = rootShardPrefix;
- this.cohorts = cohorts;
+ this.rootShardPrefix = Preconditions.checkNotNull(rootShardPrefix);
+ this.cohorts = Preconditions.checkNotNull(cohorts);
commitBlocking();
return null;
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;
LOG.warn("Shard: {} Submit Error during phase Commit, starting Abort", rootShardPrefix, e);
//FIXME abort here
throw e;
package org.opendaylight.mdsal.dom.store.inmemory;
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 com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
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) {
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
- this.rootShardPrefix = rootShardPrefix;
- this.cohorts = cohorts;
+ this.rootShardPrefix = Preconditions.checkNotNull(rootShardPrefix);
+ this.cohorts = Preconditions.checkNotNull(cohorts);
preCommitBlocking();
return null;
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;
LOG.warn("Shard: {} Submit Error during phase {}, starting Abort", rootShardPrefix, e);
//FIXME abort here
throw e;
package org.opendaylight.mdsal.dom.store.inmemory;
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 java.util.Collection;
import java.util.concurrent.Callable;
import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 static final Logger LOG = LoggerFactory.getLogger(ShardSubmitCoordinationTask.class);
private final ShardCommitCoordinationTask commitCoordinationTask;
private final ShardCommitCoordinationTask commitCoordinationTask;
- ShardSubmitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
+ public ShardSubmitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
- this.rootShardPrefix = rootShardPrefix;
+ this.rootShardPrefix = Preconditions.checkNotNull(rootShardPrefix);
canCommitCoordinationTask = new ShardCanCommitCoordinationTask(rootShardPrefix, cohorts);
preCommitCoordinationTask = new ShardPreCommitCoordinationTask(rootShardPrefix, cohorts);
canCommitCoordinationTask = new ShardCanCommitCoordinationTask(rootShardPrefix, cohorts);
preCommitCoordinationTask = new ShardPreCommitCoordinationTask(rootShardPrefix, cohorts);