use of akka.cluster.Member in project controller by opendaylight.
the class IntegrationTestKit method waitForMembersUp.
public void waitForMembersUp(final String... otherMembers) {
Set<String> otherMembersSet = Sets.newHashSet(otherMembers);
Stopwatch sw = Stopwatch.createStarted();
while (sw.elapsed(TimeUnit.SECONDS) <= 10) {
CurrentClusterState state = Cluster.get(getSystem()).state();
for (Member m : state.getMembers()) {
if (m.status() == MemberStatus.up() && otherMembersSet.remove(m.getRoles().iterator().next()) && otherMembersSet.isEmpty()) {
return;
}
}
Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
}
fail("Member(s) " + otherMembersSet + " are not Up");
}
use of akka.cluster.Member in project controller by opendaylight.
the class MockClusterWrapper method createMemberUp.
public static MemberUp createMemberUp(final String memberName, final String address) {
UniqueAddress uniqueAddress = new UniqueAddress(AddressFromURIString.parse(address), 55L);
Member member = new Member(uniqueAddress, 1, MemberStatus.up(), setOf(memberName));
return new MemberUp(member);
}
use of akka.cluster.Member in project controller by opendaylight.
the class MockClusterWrapper method createReachableMember.
public static ReachableMember createReachableMember(final String memberName, final String address) {
UniqueAddress uniqueAddress = new UniqueAddress(AddressFromURIString.parse(address), 55L);
Member member = new Member(uniqueAddress, 1, MemberStatus.up(), setOf(memberName));
return new ReachableMember(member);
}
use of akka.cluster.Member in project controller by opendaylight.
the class MockClusterWrapper method createMemberRemoved.
public static MemberRemoved createMemberRemoved(final String memberName, final String address) {
UniqueAddress uniqueAddress = new UniqueAddress(AddressFromURIString.parse(address), 55L);
Member member = new Member(uniqueAddress, 1, MemberStatus.removed(), setOf(memberName));
return new MemberRemoved(member, MemberStatus.up());
}
use of akka.cluster.Member in project controller by opendaylight.
the class Follower method isLeaderAvailabilityKnown.
private boolean isLeaderAvailabilityKnown() {
if (leaderId == null) {
return false;
}
Optional<Cluster> cluster = context.getCluster();
if (!cluster.isPresent()) {
return false;
}
ActorSelection leaderActor = context.getPeerActorSelection(leaderId);
if (leaderActor == null) {
return false;
}
Address leaderAddress = leaderActor.anchorPath().address();
CurrentClusterState state = cluster.get().state();
Set<Member> unreachable = state.getUnreachable();
log.debug("{}: Checking for leader {} in the cluster unreachable set {}", logName(), leaderAddress, unreachable);
for (Member m : unreachable) {
if (leaderAddress.equals(m.address())) {
log.info("{}: Leader {} is unreachable", logName(), leaderAddress);
return false;
}
}
for (Member m : state.getMembers()) {
if (leaderAddress.equals(m.address())) {
if (m.status() == MemberStatus.up() || m.status() == MemberStatus.weaklyUp()) {
log.debug("{}: Leader {} cluster status is {} - leader is available", logName(), leaderAddress, m.status());
return true;
} else {
log.debug("{}: Leader {} cluster status is {} - leader is unavailable", logName(), leaderAddress, m.status());
return false;
}
}
}
log.debug("{}: Leader {} not found in the cluster member set", logName(), leaderAddress);
return false;
}
Aggregations