X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dummy-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fdummy%2Fdatastore%2FDummyShardManager.java;h=a25a0814c26f77b3bb6de0942d089bc8e76d304d;hp=339f37e0bbe632c3c76bf09d94be1fbe71dcd9a1;hb=12fcdfe39aa26dcba7fd3bb4d4c68e3d02e65c51;hpb=669ca536b9d889c65e91da66af61988f9d4271dd diff --git a/opendaylight/md-sal/sal-dummy-distributed-datastore/src/main/java/org/opendaylight/controller/dummy/datastore/DummyShardManager.java b/opendaylight/md-sal/sal-dummy-distributed-datastore/src/main/java/org/opendaylight/controller/dummy/datastore/DummyShardManager.java index 339f37e0bb..a25a0814c2 100644 --- a/opendaylight/md-sal/sal-dummy-distributed-datastore/src/main/java/org/opendaylight/controller/dummy/datastore/DummyShardManager.java +++ b/opendaylight/md-sal/sal-dummy-distributed-datastore/src/main/java/org/opendaylight/controller/dummy/datastore/DummyShardManager.java @@ -11,40 +11,20 @@ package org.opendaylight.controller.dummy.datastore; import akka.actor.ActorContext; import akka.actor.Props; import akka.actor.UntypedActor; -import akka.japi.Creator; public class DummyShardManager extends UntypedActor { - public DummyShardManager(Configuration configuration, String memberName, String[] shardNames, String type) throws Exception { + public DummyShardManager(Configuration configuration, String memberName, String[] shardNames, + String type) { new DummyShardsCreator(configuration, context(), memberName, shardNames, type).create(); } @Override - public void onReceive(Object o) throws Exception { + public void onReceive(Object message) { } - public static Props props(Configuration configuration, String memberName, String[] shardNames, String type){ - return Props.create(new DummyShardManagerCreator(configuration, memberName, shardNames, type)); - } - - private static class DummyShardManagerCreator implements Creator { - - private final Configuration configuration; - private final String memberName; - private final String[] shardNames; - private final String type; - - public DummyShardManagerCreator(Configuration configuration, String memberName, String[] shardNames, String type) { - this.configuration = configuration; - this.memberName = memberName; - this.shardNames = shardNames; - this.type = type; - } - - @Override - public DummyShardManager create() throws Exception { - return new DummyShardManager(configuration, memberName, shardNames, type ); - } + public static Props props(Configuration configuration, String memberName, String[] shardNames, String type) { + return Props.create(DummyShardManager.class, configuration, memberName, shardNames, type); } private static class DummyShardsCreator { @@ -54,7 +34,8 @@ public class DummyShardManager extends UntypedActor { private final String[] shardNames; private final String type; - DummyShardsCreator(Configuration configuration, ActorContext actorSystem, String memberName, String[] shardNames, String type){ + DummyShardsCreator(Configuration configuration, ActorContext actorSystem, String memberName, + String[] shardNames, String type) { this.configuration = configuration; this.actorSystem = actorSystem; this.memberName = memberName; @@ -62,8 +43,8 @@ public class DummyShardManager extends UntypedActor { this.type = type; } - void create(){ - for(String shardName : shardNames){ + void create() { + for (String shardName : shardNames) { String shardId = memberName + "-shard-" + shardName + "-" + type; actorSystem.actorOf(DummyShard.props(configuration, shardId), shardId); }