Class ZooCacheFactory


  • public class ZooCacheFactory
    extends Object
    A factory for ZooCache instances.

    Implementation note: We were using the instances map to track all the instances that have been created, so we could explicitly close them when the SingletonManager detected that the last legacy client (using Connector/ZooKeeperInstance) has gone away. This class may no longer be needed, since the legacy client code has been removed, so long as the ZooCache instances it is tracking are managed as resources within ClientContext or ServerContext, and explicitly closed when those are closed.

    • Constructor Detail

      • ZooCacheFactory

        public ZooCacheFactory()
    • Method Detail

      • getZooCache

        public ZooCache getZooCache​(String zooKeepers,
                                    int sessionTimeout)
        Gets a ZooCache. The same object may be returned for multiple calls with the same arguments.
        Parameters:
        zooKeepers - comma-separated list of ZooKeeper host[:port]s
        sessionTimeout - session timeout
        Returns:
        cache object
      • getNewZooCache

        public ZooCache getNewZooCache​(String zooKeepers,
                                       int sessionTimeout)
        Always return a new ZooCache.
        Parameters:
        zooKeepers - comma-separated list of ZooKeeper host[:port]s
        sessionTimeout - session timeout
        Returns:
        a new instance