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()) {
Future f = operationService.createInvocationBuilder(ClusterServiceImpl.SERVICE_NAME,
new PrepareMergeOperation(targetAddress), member.getAddress())
.setTryCount(3).invoke();
calls.add(f);
}
}
for (Future f : calls) {
try {
f.get(1, TimeUnit.SECONDS);
} catch (Exception e) {
logger.finest( "While waiting merge response...", e);
}
}
final PrepareMergeOperation prepareMergeOperation = new PrepareMergeOperation(targetAddress);
prepareMergeOperation.setNodeEngine(node.nodeEngine).setService(node.getClusterService())
.setResponseHandler(ResponseHandlerFactory.createEmptyResponseHandler());
operationService.runOperation(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.runOperation(mergeClustersOperation);
}