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%2FClusterWrapperImpl.java;h=56229132f34c3dec9a61ea1ea4377831f2af3274;hp=857510ad4b5360ef3870ac16bce00e188cee88a7;hb=24c074a4b32ac97980a652b78824b7c2f97ffb78;hpb=1222784937d4cb70662f066779133ab2bdd27cfc 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 857510ad4b..56229132f3 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 @@ -10,14 +10,16 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorRef; import akka.actor.ActorSystem; +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 String selfAddress; + private final MemberName currentMemberName; + private final Address selfAddress; public ClusterWrapperImpl(ActorSystem actorSystem){ Preconditions.checkNotNull(actorSystem, "actorSystem should not be null"); @@ -31,24 +33,27 @@ public class ClusterWrapperImpl implements ClusterWrapper { "member-3 here would be the name of the member" ); - currentMemberName = (String) cluster.getSelfRoles().toArray()[0]; - selfAddress = cluster.selfAddress().toString(); - + currentMemberName = MemberName.forName(cluster.getSelfRoles().iterator().next()); + selfAddress = cluster.selfAddress(); } + @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; } - public String getSelfAddress() { + @Override + public Address getSelfAddress() { return selfAddress; } }