Skip to content

Commit

Permalink
Core: Fix NPE. The future field is set from a different thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvg committed Apr 17, 2015
1 parent 4b906ab commit cb45355
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -516,7 +516,7 @@ public void run() {
class NotifyTimeout implements Runnable {
final TimeoutClusterStateListener listener;
final TimeValue timeout;
ScheduledFuture future;
volatile ScheduledFuture future;

NotifyTimeout(TimeoutClusterStateListener listener, TimeValue timeout) {
this.listener = listener;
Expand All @@ -529,7 +529,7 @@ public void cancel() {

@Override
public void run() {
if (future.isCancelled()) {
if (future != null && future.isCancelled()) {
return;
}
if (lifecycle.stoppedOrClosed()) {
Expand Down

0 comments on commit cb45355

Please sign in to comment.