Merge pull request #84 from rankinc/lease-renewal-threads

Always shutdown leaseRenewalThreadpool on exit.
This commit is contained in:
Justin Pfifer 2016-07-21 09:58:26 -07:00 committed by GitHub
commit d695c0ab80

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;