Class Announcer
- java.lang.Object
-
- org.apache.druid.curator.announcement.Announcer
-
public class Announcer extends Object
Announces things on Zookeeper.
-
-
Constructor Summary
Constructors Constructor Description Announcer(org.apache.curator.framework.CuratorFramework curator, ExecutorService exec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidannounce(String path, byte[] bytes)Like announce(path, bytes, true).voidannounce(String path, byte[] bytes, boolean removeParentIfCreated)Announces the provided bytes at the given path.voidstart()voidstop()voidunannounce(String path)Unannounces an announcement created at path.voidupdate(String path, byte[] bytes)
-
-
-
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 atbytes- The payload to announceremoveParentIfCreated- 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
-
-