X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardManager.java;h=2972772a4840cf5117ef3b9c9ca2cb4947d2352c;hp=6162a0327ca6ab229be75b4f8b8c2c994dcb253a;hb=d0bf270d0493c04ac2e9e4a9f7de56e5b65a4ef2;hpb=971b179000ef1cc56699de35061cf6f97d4cf36f diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java index 6162a0327c..2972772a48 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java @@ -30,6 +30,8 @@ import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolve import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound; import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound; import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext; +import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties; + import scala.concurrent.duration.Duration; import java.util.ArrayList; @@ -68,15 +70,19 @@ public class ShardManager extends AbstractUntypedActor { private ShardManagerInfoMBean mBean; + private final InMemoryDOMDataStoreConfigProperties dataStoreProperties; + /** * @param type defines the kind of data that goes into shards created by this shard manager. Examples of type would be * configuration or operational */ - private ShardManager(String type, ClusterWrapper cluster, Configuration configuration) { + private ShardManager(String type, ClusterWrapper cluster, Configuration configuration, + InMemoryDOMDataStoreConfigProperties dataStoreProperties) { this.type = Preconditions.checkNotNull(type, "type should not be null"); this.cluster = Preconditions.checkNotNull(cluster, "cluster should not be null"); this.configuration = Preconditions.checkNotNull(configuration, "configuration should not be null"); + this.dataStoreProperties = dataStoreProperties; // Subscribe this actor to cluster member events cluster.subscribeToMemberEvents(getSelf()); @@ -88,7 +94,8 @@ public class ShardManager extends AbstractUntypedActor { public static Props props(final String type, final ClusterWrapper cluster, - final Configuration configuration) { + final Configuration configuration, + final InMemoryDOMDataStoreConfigProperties dataStoreProperties) { Preconditions.checkNotNull(type, "type should not be null"); Preconditions.checkNotNull(cluster, "cluster should not be null"); @@ -98,7 +105,7 @@ public class ShardManager extends AbstractUntypedActor { @Override public ShardManager create() throws Exception { - return new ShardManager(type, cluster, configuration); + return new ShardManager(type, cluster, configuration, dataStoreProperties); } }); } @@ -243,7 +250,7 @@ public class ShardManager extends AbstractUntypedActor { ShardIdentifier shardId = getShardIdentifier(memberName, shardName); Map peerAddresses = getPeerAddresses(shardName); ActorRef actor = getContext() - .actorOf(Shard.props(shardId, peerAddresses), + .actorOf(Shard.props(shardId, peerAddresses, dataStoreProperties), shardId.toString()); localShardActorNames.add(shardId.toString()); localShards.put(shardName, new ShardInformation(shardName, actor, peerAddresses)); @@ -283,10 +290,17 @@ public class ShardManager extends AbstractUntypedActor { @Override public SupervisorStrategy supervisorStrategy() { + return new OneForOneStrategy(10, Duration.create("1 minute"), new Function() { @Override public SupervisorStrategy.Directive apply(Throwable t) { + StringBuilder sb = new StringBuilder(); + for(StackTraceElement element : t.getStackTrace()) { + sb.append("\n\tat ") + .append(element.toString()); + } + LOG.warning("Supervisor Strategy of resume applied {}",sb.toString()); return SupervisorStrategy.resume(); } }