use of com.hazelcast.jet.core.TopologyChangedException in project hazelcast-jet by hazelcast.
the class JobExecutionService method onMemberLeave.
/**
* Cancels executions that contain the left address as the coordinator or a
* job participant
*/
void onMemberLeave(Address address) {
executionContexts.values().stream().filter(exeCtx -> exeCtx.coordinator().equals(address) || exeCtx.hasParticipant(address)).forEach(exeCtx -> {
String message = String.format("Completing %s locally. Reason: Coordinator %s left the cluster", jobAndExecutionId(exeCtx.jobId(), exeCtx.executionId()), address);
cancelAndComplete(exeCtx, message, new TopologyChangedException("Topology has been changed."));
});
}
use of com.hazelcast.jet.core.TopologyChangedException in project hazelcast-jet by hazelcast.
the class ExecutionPlanBuilder method initPartitionOwnersAndMembers.
private static void initPartitionOwnersAndMembers(NodeEngine nodeEngine, MembersView membersView, Collection<MemberInfo> members, Address[] partitionOwners) {
IPartitionService partitionService = nodeEngine.getPartitionService();
for (int partitionId = 0; partitionId < partitionOwners.length; partitionId++) {
Address address = partitionService.getPartitionOwnerOrWait(partitionId);
MemberInfo member;
if ((member = membersView.getMember(address)) == null) {
// it has just left the cluster.
throw new TopologyChangedException("Topology changed, " + address + " is not in original member list");
}
// add member to known members
members.add(member);
partitionOwners[partitionId] = address;
}
}
Aggregations