Cancel cleaner future in doClose() rather than doStop()

Original commit: elastic/x-pack-elasticsearch@39ca253b31
This commit is contained in:
Tanguy Leroux 2016-04-04 19:11:12 +02:00
parent 7ea2a4da9d
commit 192e0cd582
1 changed files with 4 additions and 4 deletions

View File

@ -65,14 +65,14 @@ public class CleanerService extends AbstractLifecycleComponent<CleanerService> {
protected void doStop() {
logger.debug("stopping cleaning service");
listeners.clear();
runnable.cancel();
logger.debug("cleaning service stopped");
}
@Override
protected void doClose() {
// Cleaner runnable should have been cancelled in doStop() method,
// normally called just before this one
logger.debug("closing cleaning service");
runnable.cancel();
logger.debug("cleaning service closed");
}
private String executorName() {
@ -220,7 +220,7 @@ public class CleanerService extends AbstractLifecycleComponent<CleanerService> {
* stopped.
*/
public void cancel() {
if (future.isCancelled() == false) {
if (future != null && future.isCancelled() == false) {
FutureUtils.cancel(future);
}
}