@Override
public void init(final NodeEngine nodeEngine, Properties properties) {
long mergeFirstRunDelay = node.getGroupProperties().MERGE_FIRST_RUN_DELAY_SECONDS.getLong() * 1000;
mergeFirstRunDelay = mergeFirstRunDelay <= 0 ? 100 : mergeFirstRunDelay; // milliseconds
ExecutionService executionService = nodeEngine.getExecutionService();
executionService.register(EXECUTOR_NAME, 2, 1000, ExecutorType.CACHED);
long mergeNextRunDelay = node.getGroupProperties().MERGE_NEXT_RUN_DELAY_SECONDS.getLong() * 1000;
mergeNextRunDelay = mergeNextRunDelay <= 0 ? 100 : mergeNextRunDelay; // milliseconds
executionService.scheduleWithFixedDelay(EXECUTOR_NAME, new SplitBrainHandler(node),
mergeFirstRunDelay, mergeNextRunDelay, TimeUnit.MILLISECONDS);
long heartbeatInterval = node.groupProperties.HEARTBEAT_INTERVAL_SECONDS.getInteger();
heartbeatInterval = heartbeatInterval <= 0 ? 1 : heartbeatInterval;
executionService.scheduleWithFixedDelay(EXECUTOR_NAME, new Runnable() {
public void run() {
heartBeater();
}
}, heartbeatInterval, heartbeatInterval, TimeUnit.SECONDS);
long masterConfirmationInterval = node.groupProperties.MASTER_CONFIRMATION_INTERVAL_SECONDS.getInteger();
masterConfirmationInterval = masterConfirmationInterval <= 0 ? 1 : masterConfirmationInterval;
executionService.scheduleWithFixedDelay(EXECUTOR_NAME, new Runnable() {
public void run() {
sendMasterConfirmation();
}
}, masterConfirmationInterval, masterConfirmationInterval, TimeUnit.SECONDS);
long memberListPublishInterval = node.groupProperties.MEMBER_LIST_PUBLISH_INTERVAL_SECONDS.getInteger();
memberListPublishInterval = memberListPublishInterval <= 0 ? 1 : memberListPublishInterval;
executionService.scheduleWithFixedDelay(EXECUTOR_NAME, new Runnable() {
public void run() {
sendMemberListToOthers();
}
}, memberListPublishInterval, memberListPublishInterval, TimeUnit.SECONDS);
}