Interface CuratorCacheListenerBuilder
public interface CuratorCacheListenerBuilder
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionMake the built listener so that it only becomes active onceCuratorCacheListener.initialized()
has been called.build()
Build and return a new listener based on the methods that have been previously calledforAll
(CuratorCacheListener listener) Add a standard listenerAdd a listener only forCuratorCacheListener.Type.NODE_CHANGED
forCreates
(Consumer<ChildData> listener) Add a listener only forCuratorCacheListener.Type.NODE_CREATED
Add a listener only bothCuratorCacheListener.Type.NODE_CREATED
andCuratorCacheListener.Type.NODE_CHANGED
forDeletes
(Consumer<ChildData> listener) Add a listener only forCuratorCacheListener.Type.NODE_DELETED
forInitialized
(Runnable listener) Add a listener only forCuratorCacheListener.initialized()
forNodeCache
(NodeCacheListener listener) Bridge listener.forPathChildrenCache
(String rootPath, CuratorFramework client, PathChildrenCacheListener listener) Bridge listener.forTreeCache
(CuratorFramework client, TreeCacheListener listener) Bridge listener.
-
Method Details
-
forAll
Add a standard listener- Parameters:
listener
- listener to add- Returns:
- this
-
forCreates
Add a listener only forCuratorCacheListener.Type.NODE_CREATED
- Parameters:
listener
- listener to add- Returns:
- this
-
forChanges
Add a listener only forCuratorCacheListener.Type.NODE_CHANGED
- Parameters:
listener
- listener to add- Returns:
- this
-
forCreatesAndChanges
CuratorCacheListenerBuilder forCreatesAndChanges(CuratorCacheListenerBuilder.ChangeListener listener) Add a listener only bothCuratorCacheListener.Type.NODE_CREATED
andCuratorCacheListener.Type.NODE_CHANGED
- Parameters:
listener
- listener to add- Returns:
- this
-
forDeletes
Add a listener only forCuratorCacheListener.Type.NODE_DELETED
- Parameters:
listener
- listener to add- Returns:
- this
-
forInitialized
Add a listener only forCuratorCacheListener.initialized()
- Parameters:
listener
- listener to add- Returns:
- this
-
forPathChildrenCache
CuratorCacheListenerBuilder forPathChildrenCache(String rootPath, CuratorFramework client, PathChildrenCacheListener listener) Bridge listener. You can reuse old-stylePathChildrenCacheListener
s with CuratorCache. IMPORTANT: the connection state methods in the listener will never be called as CuratorCache does not register the listener with the connection state listener container. Also note that CuratorCache behaves differently thanPathChildrenCache
so things such as event ordering will likely be different.- Parameters:
rootPath
- the root path. The listener needs this information in order to bridge only events for children of this path and not the path itselfclient
- the curator clientlistener
- the listener to wrap- Returns:
- a CuratorCacheListener that forwards to the given listener
-
forTreeCache
Bridge listener. You can reuse old-styleTreeCacheListener
s with CuratorCache. IMPORTANT: the connection state methods in the listener will never be called as CuratorCache does not register the listener with the connection state listener container. Also note that CuratorCache behaves differently thanTreeCache
so things such as event ordering will likely be different.- Parameters:
client
- the curator clientlistener
- the listener to wrap- Returns:
- a CuratorCacheListener that forwards to the given listener
-
forNodeCache
Bridge listener. You can reuse old-styleNodeCacheListener
s with CuratorCache.- Parameters:
listener
- the listener to wrap- Returns:
- a CuratorCacheListener that forwards to the given listener
-
afterInitialized
CuratorCacheListenerBuilder afterInitialized()Make the built listener so that it only becomes active onceCuratorCacheListener.initialized()
has been called. i.e. changes that occur as the cache is initializing are not sent to the listener -
build
CuratorCacheListener build()Build and return a new listener based on the methods that have been previously called- Returns:
- new listener
-