use of com.hazelcast.cp.internal.raft.impl.RaftEndpoint in project hazelcast by hazelcast.
the class RaftStateTest method isKnownEndpoint.
@Test
public void isKnownEndpoint() {
for (RaftEndpoint endpoint : members) {
assertTrue(state.isKnownMember(endpoint));
}
assertFalse(state.isKnownMember(newRaftMember(1234)));
assertFalse(state.isKnownMember(new TestRaftEndpoint(UUID.randomUUID(), localMember.getPort())));
assertFalse(state.isKnownMember(new TestRaftEndpoint(localMember.getUuid(), 1234)));
}
use of com.hazelcast.cp.internal.raft.impl.RaftEndpoint in project hazelcast by hazelcast.
the class LocalRaftGroup method getNodesExcept.
public RaftNodeImpl[] getNodesExcept(RaftEndpoint endpoint) {
RaftNodeImpl[] n = new RaftNodeImpl[nodes.length - 1];
int i = 0;
for (RaftNodeImpl node : nodes) {
if (!node.getLocalMember().equals(endpoint)) {
n[i++] = node;
}
}
if (i != n.length) {
throw new IllegalArgumentException();
}
return n;
}
use of com.hazelcast.cp.internal.raft.impl.RaftEndpoint in project hazelcast by hazelcast.
the class LocalRaftGroup method allowMessagesToAll.
/**
* Allows specific message type one-way from -> to all nodes.
*/
public void allowMessagesToAll(RaftEndpoint from, Class messageType) {
LocalRaftIntegration integration = getIntegration(getIndexOfRunning(from));
for (RaftEndpoint endpoint : members) {
if (!integration.isReachable(endpoint)) {
throw new IllegalStateException("Cannot allow " + messageType + " from " + from + " -> " + endpoint + ", since all messages are dropped between.");
}
}
integration.allowMessagesToAll(messageType);
}
use of com.hazelcast.cp.internal.raft.impl.RaftEndpoint in project hazelcast by hazelcast.
the class LocalRaftGroup method split.
/**
* Split nodes having these members from rest of the cluster.
*/
public void split(RaftEndpoint... endpoints) {
int[] indexes = new int[endpoints.length];
for (int i = 0; i < indexes.length; i++) {
indexes[i] = getIndexOfRunning(endpoints[i]);
}
split(indexes);
}
use of com.hazelcast.cp.internal.raft.impl.RaftEndpoint in project hazelcast by hazelcast.
the class LocalRaftGroup method createNewRaftNode.
public RaftNodeImpl createNewRaftNode(RestoredRaftState restoredRaftState, RaftStateStore stateStore) {
checkNotNull(restoredRaftState);
int oldSize = this.integrations.length;
int newSize = oldSize + 1;
RaftEndpoint[] endpoints = new RaftEndpoint[newSize];
LocalRaftIntegration[] integrations = new LocalRaftIntegration[newSize];
RaftNodeImpl[] nodes = new RaftNodeImpl[newSize];
System.arraycopy(this.members, 0, endpoints, 0, oldSize);
System.arraycopy(this.integrations, 0, integrations, 0, oldSize);
System.arraycopy(this.nodes, 0, nodes, 0, oldSize);
LocalRaftIntegration integration = createNewLocalRaftIntegration((TestRaftEndpoint) restoredRaftState.localEndpoint());
createdNodeCount++;
integrations[oldSize] = integration;
RaftEndpoint endpoint = integration.getLocalEndpoint();
endpoints[oldSize] = endpoint;
RaftNodeImpl node = restoreRaftNode(groupId, restoredRaftState, raftAlgorithmConfig, integration, stateStore);
nodes[oldSize] = node;
this.members = endpoints;
this.integrations = integrations;
this.nodes = nodes;
node.start();
initDiscovery();
return node;
}
Aggregations