parent
435eabd4a0
commit
512585da82
|
@ -189,19 +189,19 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
||||||
localNodeMasterListeners.remove(listener);
|
localNodeMasterListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(TimeValue timeout, final TimeoutClusterStateListener listener) {
|
public void add(final TimeValue timeout, final TimeoutClusterStateListener listener) {
|
||||||
if (lifecycle.stoppedOrClosed()) {
|
if (lifecycle.stoppedOrClosed()) {
|
||||||
listener.onClose();
|
listener.onClose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NotifyTimeout notifyTimeout = new NotifyTimeout(listener, timeout);
|
|
||||||
notifyTimeout.future = threadPool.schedule(timeout, ThreadPool.Names.GENERIC, notifyTimeout);
|
|
||||||
onGoingTimeouts.add(notifyTimeout);
|
|
||||||
clusterStateListeners.add(listener);
|
|
||||||
// call the post added notification on the same event thread
|
// call the post added notification on the same event thread
|
||||||
updateTasksExecutor.execute(new Runnable() {
|
updateTasksExecutor.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
NotifyTimeout notifyTimeout = new NotifyTimeout(listener, timeout);
|
||||||
|
notifyTimeout.future = threadPool.schedule(timeout, ThreadPool.Names.GENERIC, notifyTimeout);
|
||||||
|
onGoingTimeouts.add(notifyTimeout);
|
||||||
|
clusterStateListeners.add(listener);
|
||||||
listener.postAdded();
|
listener.postAdded();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue