joinStartTime.set(Clock.currentTimeMillis());
tryCount.set(0);
}
protected void startClusterMerge(final Address targetAddress) {
final OperationService operationService = node.nodeEngine.getOperationService();
final Collection<MemberImpl> memberList = node.getClusterService().getMemberList();
final Collection<Future> calls = new ArrayList<Future>();
for (MemberImpl member : memberList) {
if (!member.localMember()) {
Operation operation = new PrepareMergeOperation(targetAddress);
Future f = operationService.createInvocationBuilder(ClusterServiceImpl.SERVICE_NAME,
operation, member.getAddress()).setTryCount(3).invoke();
calls.add(f);
}
}
try {
waitWithDeadline(calls, 1, TimeUnit.SECONDS, WHILE_WAIT_MERGE_EXCEPTION_HANDLER);
} catch (TimeoutException e) {
logger.warning("While waiting merge response...", e);
}
final PrepareMergeOperation prepareMergeOperation = new PrepareMergeOperation(targetAddress);
prepareMergeOperation.setNodeEngine(node.nodeEngine).setService(node.getClusterService())
.setResponseHandler(ResponseHandlerFactory.createEmptyResponseHandler());
operationService.runOperationOnCallingThread(prepareMergeOperation);
for (MemberImpl member : memberList) {
if (!member.localMember()) {
operationService.createInvocationBuilder(ClusterServiceImpl.SERVICE_NAME,
new MergeClustersOperation(targetAddress), member.getAddress())
.setTryCount(1).invoke();
}
}
final MergeClustersOperation mergeClustersOperation = new MergeClustersOperation(targetAddress);
mergeClustersOperation.setNodeEngine(node.nodeEngine).setService(node.getClusterService())
.setResponseHandler(ResponseHandlerFactory.createEmptyResponseHandler());
operationService.runOperationOnCallingThread(mergeClustersOperation);
}