Always shutdown leaseRenewalThreadpool on exit.

This commit is contained in:
Chris Rankin 2016-06-29 10:52:54 +01:00
parent 6d3ffff870
commit 6647b4b642

View file

@ -80,7 +80,7 @@ public class LeaseCoordinator<T extends Lease> {
protected final IMetricsFactory metricsFactory; protected final IMetricsFactory metricsFactory;
private ScheduledExecutorService leaseCoordinatorThreadPool; private ScheduledExecutorService leaseCoordinatorThreadPool;
private ExecutorService leaseRenewalThreadpool; private final ExecutorService leaseRenewalThreadpool;
private volatile boolean running = false; private volatile boolean running = false;
/** /**
@ -290,7 +290,6 @@ public class LeaseCoordinator<T extends Lease> {
leaseTaker.getWorkerIdentifier())); leaseTaker.getWorkerIdentifier()));
} else { } else {
leaseCoordinatorThreadPool.shutdownNow(); leaseCoordinatorThreadPool.shutdownNow();
leaseRenewalThreadpool.shutdownNow();
LOG.info(String.format("Worker %s stopped lease-tracking threads %dms after stop", LOG.info(String.format("Worker %s stopped lease-tracking threads %dms after stop",
leaseTaker.getWorkerIdentifier(), leaseTaker.getWorkerIdentifier(),
STOP_WAIT_TIME_MILLIS)); STOP_WAIT_TIME_MILLIS));
@ -302,6 +301,7 @@ public class LeaseCoordinator<T extends Lease> {
LOG.debug("Threadpool was null, no need to shutdown/terminate threadpool."); LOG.debug("Threadpool was null, no need to shutdown/terminate threadpool.");
} }
leaseRenewalThreadpool.shutdownNow();
synchronized (shutdownLock) { synchronized (shutdownLock) {
leaseRenewer.clearCurrentlyHeldLeases(); leaseRenewer.clearCurrentlyHeldLeases();
running = false; running = false;