Merge pull request #15772 from jasontedor/test-cluster-service-no-timeout

Fix NPE in TestClusterService when waiting indefinitely
This commit is contained in:
Jason Tedor 2016-01-05 09:57:06 -05:00
commit 5226186a81
1 changed files with 5 additions and 3 deletions

View File

@ -184,9 +184,11 @@ public class TestClusterService implements ClusterService {
if (threadPool == null) {
throw new UnsupportedOperationException("TestClusterService wasn't initialized with a thread pool");
}
NotifyTimeout notifyTimeout = new NotifyTimeout(listener, timeout);
notifyTimeout.future = threadPool.schedule(timeout, ThreadPool.Names.GENERIC, notifyTimeout);
onGoingTimeouts.add(notifyTimeout);
if (timeout != null) {
NotifyTimeout notifyTimeout = new NotifyTimeout(listener, timeout);
notifyTimeout.future = threadPool.schedule(timeout, ThreadPool.Names.GENERIC, notifyTimeout);
onGoingTimeouts.add(notifyTimeout);
}
listeners.add(listener);
listener.postAdded();
}