import akka.actor.Props;
import com.google.common.base.Preconditions;
import java.util.concurrent.CountDownLatch;
+import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
import org.opendaylight.controller.cluster.datastore.DatastoreContextFactory;
import org.opendaylight.controller.cluster.datastore.config.Configuration;
-import org.opendaylight.controller.cluster.datastore.messages.DatastoreSnapshot;
+import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot;
import org.opendaylight.controller.cluster.datastore.utils.PrimaryShardInfoFutureCache;
public abstract class AbstractShardManagerCreator<T extends AbstractShardManagerCreator<T>> {
private ClusterWrapper cluster;
private Configuration configuration;
private DatastoreContextFactory datastoreContextFactory;
- private CountDownLatch waitTillReadyCountdownLatch;
+ private AbstractDataStore distributedDataStore;
+ private CountDownLatch waitTillReadyCountDownLatch;
private PrimaryShardInfoFutureCache primaryShardInfoCache;
private DatastoreSnapshot restoreFromSnapshot;
private volatile boolean sealed;
return datastoreContextFactory;
}
- public T datastoreContextFactory(DatastoreContextFactory newDatastoreContextFactory) {
+ public T datastoreContextFactory(final DatastoreContextFactory newDatastoreContextFactory) {
checkSealed();
- this.datastoreContextFactory = newDatastoreContextFactory;
+ this.datastoreContextFactory = Preconditions.checkNotNull(newDatastoreContextFactory);
return self();
}
- CountDownLatch getWaitTillReadyCountdownLatch() {
- return waitTillReadyCountdownLatch;
+ AbstractDataStore getDistributedDataStore() {
+ return distributedDataStore;
}
- public T waitTillReadyCountdownLatch(CountDownLatch newWaitTillReadyCountdownLatch) {
+ public T distributedDataStore(final AbstractDataStore distributedDataStore) {
checkSealed();
- this.waitTillReadyCountdownLatch = newWaitTillReadyCountdownLatch;
+ this.distributedDataStore = distributedDataStore;
+ return self();
+ }
+
+ CountDownLatch getWaitTillReadyCountDownLatch() {
+ return waitTillReadyCountDownLatch;
+ }
+
+ public T waitTillReadyCountDownLatch(CountDownLatch newWaitTillReadyCountDownLatch) {
+ checkSealed();
+ this.waitTillReadyCountDownLatch = newWaitTillReadyCountDownLatch;
return self();
}
Preconditions.checkNotNull(cluster, "cluster should not be null");
Preconditions.checkNotNull(configuration, "configuration should not be null");
Preconditions.checkNotNull(datastoreContextFactory, "datastoreContextFactory should not be null");
- Preconditions.checkNotNull(waitTillReadyCountdownLatch, "waitTillReadyCountdownLatch should not be null");
+ Preconditions.checkNotNull(distributedDataStore, "distributedDataStore should not be null");
+ Preconditions.checkNotNull(waitTillReadyCountDownLatch, "waitTillReadyCountdownLatch should not be null");
Preconditions.checkNotNull(primaryShardInfoCache, "primaryShardInfoCache should not be null");
}