X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FClusterWrapperImpl.java;h=38d23f6884ca949e121579da0fb669391ffc058e;hb=583f30d1c7a8199b401c9393745c62fe27b5ced8;hp=d7bfae1b42b88a36be7a9e29124af53231111757;hpb=f8752ab02f7828666a8b3df04c8afd9ebe10825c;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java index d7bfae1b42..38d23f6884 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java @@ -14,40 +14,44 @@ import akka.actor.Address; import akka.cluster.Cluster; import akka.cluster.ClusterEvent; import com.google.common.base.Preconditions; +import org.opendaylight.controller.cluster.access.concepts.MemberName; public class ClusterWrapperImpl implements ClusterWrapper { private final Cluster cluster; - private final String currentMemberName; + private final MemberName currentMemberName; private final Address selfAddress; - public ClusterWrapperImpl(ActorSystem actorSystem){ + public ClusterWrapperImpl(ActorSystem actorSystem) { Preconditions.checkNotNull(actorSystem, "actorSystem should not be null"); cluster = Cluster.get(actorSystem); Preconditions.checkState(cluster.getSelfRoles().size() > 0, - "No akka roles were specified\n" + - "One way to specify the member name is to pass a property on the command line like so\n" + - " -Dakka.cluster.roles.0=member-3\n" + - "member-3 here would be the name of the member" - ); + "No akka roles were specified.\n" + + "One way to specify the member name is to pass a property on the command line like so\n" + + " -Dakka.cluster.roles.0=member-3\n" + + "member-3 here would be the name of the member"); - currentMemberName = cluster.getSelfRoles().iterator().next(); + currentMemberName = MemberName.forName(cluster.getSelfRoles().iterator().next()); selfAddress = cluster.selfAddress(); } - public void subscribeToMemberEvents(ActorRef actorRef){ + @Override + public void subscribeToMemberEvents(ActorRef actorRef) { Preconditions.checkNotNull(actorRef, "actorRef should not be null"); cluster.subscribe(actorRef, ClusterEvent.initialStateAsEvents(), ClusterEvent.MemberEvent.class, - ClusterEvent.UnreachableMember.class); + ClusterEvent.UnreachableMember.class, + ClusterEvent.ReachableMember.class); } - public String getCurrentMemberName() { + @Override + public MemberName getCurrentMemberName() { return currentMemberName; } + @Override public Address getSelfAddress() { return selfAddress; }