Class ZooCacheFactory


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

    Implementation note: We are using the instances map to track all the instances that have been created, so we can explicitly close them when the last legacy client has gone away. This is part of the "SingletonManager" code, and it is likely that ZooCacheFactory and ZooKeeperInstance can be removed when legacy client code support is no longer required.

    • 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