Possible NPE

This commit is contained in:
Edward Capriolo
2016-03-30 21:21:19 -04:00
parent a7da35f270
commit 3a40908783

View File

@ -57,7 +57,7 @@ public abstract class GossipManager extends Thread implements NotificationListen
GossipService.LOGGER.debug(member); GossipService.LOGGER.debug(member);
} }
} }
_gossipThreadExecutor = Executors.newCachedThreadPool();
_gossipServiceRunning = new AtomicBoolean(true); _gossipServiceRunning = new AtomicBoolean(true);
this.listener = listener; this.listener = listener;
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@ -143,7 +143,6 @@ public abstract class GossipManager extends Thread implements NotificationListen
member.startTimeoutTimer(); member.startTimeoutTimer();
} }
} }
_gossipThreadExecutor = Executors.newCachedThreadPool();
try { try {
passiveGossipThread = _passiveGossipThreadClass.getConstructor(GossipManager.class) passiveGossipThread = _passiveGossipThreadClass.getConstructor(GossipManager.class)
.newInstance(this); .newInstance(this);
@ -170,6 +169,7 @@ public abstract class GossipManager extends Thread implements NotificationListen
* Shutdown the gossip service. * Shutdown the gossip service.
*/ */
public void shutdown() { public void shutdown() {
_gossipServiceRunning.set(false);
_gossipThreadExecutor.shutdown(); _gossipThreadExecutor.shutdown();
passiveGossipThread.shutdown(); passiveGossipThread.shutdown();
activeGossipThread.shutdown(); activeGossipThread.shutdown();
@ -181,6 +181,5 @@ public abstract class GossipManager extends Thread implements NotificationListen
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOGGER.error(e); LOGGER.error(e);
} }
_gossipServiceRunning.set(false);
} }
} }