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