Core: Fix NPE. The `future` field is set from a different thread.

Closes #10630
This commit is contained in:
Martijn van Groningen 2015-04-16 15:07:18 +02:00
parent af191d7888
commit 161e74029f
1 changed files with 2 additions and 2 deletions

View File

@ -525,7 +525,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
class NotifyTimeout implements Runnable {
final TimeoutClusterStateListener listener;
final TimeValue timeout;
ScheduledFuture future;
volatile ScheduledFuture future;
NotifyTimeout(TimeoutClusterStateListener listener, TimeValue timeout) {
this.listener = listener;
@ -538,7 +538,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
@Override
public void run() {
if (future.isCancelled()) {
if (future != null && future.isCancelled()) {
return;
}
if (lifecycle.stoppedOrClosed()) {