Class ContainerManager

java.lang.Object
org.apache.zookeeper.server.ContainerManager

public class ContainerManager extends Object
Manages cleanup of container ZNodes. This class is meant to only be run from the leader. There's no harm in running from followers/observers but that will be extra work that's not needed. Once started, it periodically checks container nodes that have a cversion > 0 and have no children. A delete is attempted on the node. The result of the delete is unimportant. If the proposal fails or the container node is not empty there's no harm.
  • Constructor Details

    • ContainerManager

      public ContainerManager(ZKDatabase zkDb, RequestProcessor requestProcessor, int checkIntervalMs, int maxPerMinute)
      Parameters:
      zkDb - the ZK database
      requestProcessor - request processer - used to inject delete container requests
      checkIntervalMs - how often to check containers in milliseconds
      maxPerMinute - the max containers to delete per second - avoids herding of container deletions
    • ContainerManager

      public ContainerManager(ZKDatabase zkDb, RequestProcessor requestProcessor, int checkIntervalMs, int maxPerMinute, long maxNeverUsedIntervalMs)
      Parameters:
      zkDb - the ZK database
      requestProcessor - request processer - used to inject delete container requests
      checkIntervalMs - how often to check containers in milliseconds
      maxPerMinute - the max containers to delete per second - avoids herding of container deletions
      maxNeverUsedIntervalMs - the max time in milliseconds that a container that has never had any children is retained
  • Method Details