From 61101bee6ca4f229a74f9f564ec8bd4fda5d5e1a Mon Sep 17 00:00:00 2001 From: fjy Date: Mon, 15 Dec 2014 12:57:40 -0800 Subject: [PATCH] more logs for CIM --- .../inventory/CuratorInventoryManager.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java index 3c4bb2a2c6f..6bbc7beb391 100644 --- a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java +++ b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java @@ -46,10 +46,10 @@ import java.util.concurrent.atomic.AtomicReference; /** * An InventoryManager watches updates to inventory on Zookeeper (or some other discovery-like service publishing * system). It is built up on two object types: containers and inventory objects. - * + *

* The logic of the InventoryManager just maintains a local cache of the containers and inventory it sees on ZK. It * provides methods for getting at the container objects, which house the actual individual pieces of inventory. - * + *

* A Strategy is provided to the constructor of an Inventory manager, this strategy provides all of the * object-specific logic to serialize, deserialize, compose and alter the container and inventory objects. */ @@ -104,7 +104,8 @@ public class CuratorInventoryManager } catch (Exception e) { synchronized (lock) { - try { stop(); + try { + stop(); } catch (IOException e1) { log.error(e1, "Exception when stopping InventoryManager that couldn't start."); @@ -276,9 +277,9 @@ public class CuratorInventoryManager case INITIALIZED: synchronized (lock) { // must await initialized of all containerholders - for(ContainerHolder holder : containers.values()) { + for (ContainerHolder holder : containers.values()) { synchronized (holder) { - if(!holder.initialized) { + if (!holder.initialized) { uninitializedInventory.add(holder); } } @@ -300,12 +301,12 @@ public class CuratorInventoryManager private void maybeDoneInitializing() { - if(doneInitializing) { + if (doneInitializing) { return; } // only fire if we are done initializing the parent PathChildrenCache - if(containersInitialized && uninitializedInventory.isEmpty()) { + if (containersInitialized && uninitializedInventory.isEmpty()) { doneInitializing = true; strategy.inventoryInitialized(); } @@ -336,6 +337,7 @@ public class CuratorInventoryManager case CHILD_ADDED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); + log.info("CHILD_ADDED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); final InventoryClass addedInventory = strategy.deserializeInventory(child.getData()); @@ -348,6 +350,7 @@ public class CuratorInventoryManager case CHILD_UPDATED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); + log.info("CHILD_UPDATED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); final InventoryClass updatedInventory = strategy.deserializeInventory(child.getData()); @@ -361,6 +364,7 @@ public class CuratorInventoryManager case CHILD_REMOVED: { final ChildData child = event.getData(); final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); + log.info("CHILD_REMOVED[%s] with version[%s]", inventoryKey, event.getData().getStat().getVersion()); synchronized (holder) { holder.setContainer(strategy.removeInventory(holder.getContainer(), inventoryKey));