Cancel cleaner future in doClose() rather than doStop()
Original commit: elastic/x-pack-elasticsearch@39ca253b31
This commit is contained in:
parent
7ea2a4da9d
commit
192e0cd582
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue