Class ZkStateWriter


  • public class ZkStateWriter
    extends Object
    ZkStateWriter is responsible for writing updates to the cluster state stored in ZooKeeper for collections each of which gets their own individual state.json in ZK.

    Updates to the cluster state are specified using the enqueueUpdate(ClusterState, List, ZkWriteCallback) method. The class buffers updates to reduce the number of writes to ZK. The buffered updates are flushed during enqueueUpdate automatically if necessary. The writePendingUpdates() can be used to force flush any pending updates.

    If either enqueueUpdate(ClusterState, List, ZkWriteCallback) or writePendingUpdates() throws a KeeperException.BadVersionException then the internal buffered state of the class is suspect and the current instance of the class should be discarded and a new instance should be created and used for any future updates.

    • Field Detail

      • stats

        protected final Stats stats
      • lastUpdatedTime

        protected long lastUpdatedTime
      • invalidState

        protected boolean invalidState
        Set to true if we ever get a BadVersionException so that we can disallow future operations with this instance
    • Constructor Detail