Class Announcer


  • public class Announcer
    extends Object
    Announces things on Zookeeper.
    • Constructor Detail

      • Announcer

        public Announcer​(org.apache.curator.framework.CuratorFramework curator,
                         ExecutorService exec)
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
      • announce

        public void announce​(String path,
                             byte[] bytes)
        Like announce(path, bytes, true).
      • announce

        public void announce​(String path,
                             byte[] bytes,
                             boolean removeParentIfCreated)
        Announces the provided bytes at the given path. Announcement means that it will create an ephemeral node and monitor it to make sure that it always exists until it is unannounced or this object is closed.
        Parameters:
        path - The path to announce at
        bytes - The payload to announce
        removeParentIfCreated - remove parent of "path" if we had created that parent
      • update

        public void update​(String path,
                           byte[] bytes)
      • unannounce

        public void unannounce​(String path)
        Unannounces an announcement created at path. Note that if all announcements get removed, the Announcer will continue to have ZK watches on paths because clearing them out is a source of ugly race conditions.

        If you need to completely clear all the state of what is being watched and announced, stop() the Announcer.

        Parameters:
        path - the path to unannounce