use of com.hazelcast.cp.internal.raft.impl.RaftNodeImpl in project hazelcast by hazelcast.
the class HazelcastRaftTestSupport method getRandomFollowerInstance.
protected static HazelcastInstance getRandomFollowerInstance(HazelcastInstance[] instances, CPGroupId groupId) {
RaftNodeImpl[] raftNodeRef = new RaftNodeImpl[1];
assertTrueEventually(() -> {
for (HazelcastInstance instance : instances) {
RaftNodeImpl raftNode = getRaftNode(instance, groupId);
if (raftNode != null) {
raftNodeRef[0] = raftNode;
return;
}
}
fail();
});
RaftNodeImpl raftNode = raftNodeRef[0];
waitUntilLeaderElected(raftNode);
RaftEndpoint leaderEndpoint = getLeaderMember(raftNode);
assertNotNull(leaderEndpoint);
for (HazelcastInstance instance : instances) {
CPMember cpMember = instance.getCPSubsystem().getLocalCPMember();
if (cpMember != null && !cpMember.getUuid().equals(leaderEndpoint.getUuid())) {
return instance;
}
}
throw new AssertionError();
}
use of com.hazelcast.cp.internal.raft.impl.RaftNodeImpl in project hazelcast by hazelcast.
the class LocalRaftIntegration method send.
@Override
public boolean send(AppendSuccessResponse response, RaftEndpoint target) {
assertNotEquals(localEndpoint, target);
RaftNodeImpl node = nodes.get(target);
if (node == null) {
return false;
}
if (shouldDrop(response, target)) {
return true;
}
node.handleAppendResponse(alterMessageIfNeeded(response, target));
return true;
}
use of com.hazelcast.cp.internal.raft.impl.RaftNodeImpl in project hazelcast by hazelcast.
the class LocalRaftIntegration method send.
@Override
public boolean send(TriggerLeaderElection request, RaftEndpoint target) {
assertNotEquals(localEndpoint, target);
RaftNodeImpl node = nodes.get(target);
if (node == null) {
return false;
}
if (shouldDrop(request, target)) {
return true;
}
node.handleTriggerLeaderElection(alterMessageIfNeeded(request, target));
return true;
}
use of com.hazelcast.cp.internal.raft.impl.RaftNodeImpl in project hazelcast by hazelcast.
the class LocalRaftIntegration method discoverNode.
void discoverNode(RaftNodeImpl node) {
assertNotEquals(localEndpoint, node.getLocalMember());
RaftNodeImpl old = nodes.putIfAbsent(node.getLocalMember(), node);
assertThat(old, anyOf(nullValue(), sameInstance(node)));
}
use of com.hazelcast.cp.internal.raft.impl.RaftNodeImpl in project hazelcast by hazelcast.
the class LocalRaftIntegration method send.
@Override
public boolean send(AppendRequest request, RaftEndpoint target) {
assertNotEquals(localEndpoint, target);
RaftNodeImpl node = nodes.get(target);
if (node == null) {
return false;
}
if (shouldDrop(request, target)) {
return true;
}
node.handleAppendRequest(alterMessageIfNeeded(request, target));
return true;
}
Aggregations