also remove curator listeners on cleanup

This commit is contained in:
fjy 2013-05-26 13:41:53 -06:00
parent 69a9e04563
commit 00cfb32541
2 changed files with 5 additions and 5 deletions

View File

@ -153,7 +153,7 @@ public class ServerInventoryView implements ServerView, InventoryView
if (segment != null) { if (segment != null) {
log.warn( log.warn(
"Not running callbacks for existing segment[%s] on server[%s]", "Not adding or running callbacks for existing segment[%s] on server[%s]",
inventoryKey, inventoryKey,
container.getName() container.getName()
); );
@ -185,7 +185,7 @@ public class ServerInventoryView implements ServerView, InventoryView
if (segment == null) { if (segment == null) {
log.warn( log.warn(
"Not running callbacks or cleanup for non-existing segment[%s] on server[%s]", "Not running cleanup or callbacks for non-existing segment[%s] on server[%s]",
inventoryKey, inventoryKey,
container.getName() container.getName()
); );

View File

@ -216,7 +216,7 @@ public class CuratorInventoryManager<ContainerClass, InventoryClass>
containers.put(containerKey, new ContainerHolder(container, inventoryCache)); containers.put(containerKey, new ContainerHolder(container, inventoryCache));
log.info("Starting inventory cache for %s, inventoryPath %s", container, inventoryPath); log.info("Starting inventory cache for %s, inventoryPath %s", containerKey, inventoryPath);
inventoryCache.start(); inventoryCache.start();
strategy.newContainer(container); strategy.newContainer(container);
} }
@ -233,8 +233,8 @@ public class CuratorInventoryManager<ContainerClass, InventoryClass>
// This close() call actually calls shutdownNow() on the executor registered with the Cache object, it // This close() call actually calls shutdownNow() on the executor registered with the Cache object, it
// better have its own executor or ignore shutdownNow() calls... // better have its own executor or ignore shutdownNow() calls...
log.info("Closing inventory cache for %s", containerKey); log.info("Closing inventory cache for %s. Also removing listeners.", containerKey);
removed.getCache().clear(); removed.getCache().getListenable().clear();
removed.getCache().close(); removed.getCache().close();
strategy.deadContainer(removed.getContainer()); strategy.deadContainer(removed.getContainer());