public interface CuratorFramework extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
blockUntilConnected()
Block until a connection to ZooKeeper is available.
|
boolean |
blockUntilConnected(int maxWaitTime,
TimeUnit units)
Block until a connection to ZooKeeper is available or the maxWaitTime has been exceeded
|
ExistsBuilder |
checkExists()
Start an exists builder
|
void |
clearWatcherReferences(org.apache.zookeeper.Watcher watcher)
Deprecated.
As of ZooKeeper 3.5 Curators recipes will handle removing watcher references
when they are no longer used. If you write your own recipe, follow the example of Curator
recipes and use
newWatcherRemoveCuratorFramework() calling WatcherRemoveCuratorFramework.removeWatchers()
when closing your instance. |
void |
close()
Stop the client
|
CreateBuilder |
create()
Start a create builder
|
void |
createContainers(String path)
Create all nodes in the specified path as containers if they don't
already exist
|
DeleteBuilder |
delete()
Start a delete builder
|
GetACLBuilder |
getACL()
Start a get ACL builder
|
GetChildrenBuilder |
getChildren()
Start a get children builder
|
GetConfigBuilder |
getConfig()
Start a getConfig builder
|
ConnectionStateErrorPolicy |
getConnectionStateErrorPolicy()
Return the configured error policy
|
Listenable<ConnectionStateListener> |
getConnectionStateListenable()
Returns the listenable interface for the Connect State
|
Listenable<CuratorListener> |
getCuratorListenable()
Returns the listenable interface for events
|
org.apache.zookeeper.server.quorum.flexible.QuorumVerifier |
getCurrentConfig()
Current maintains a cached view of the Zookeeper quorum config.
|
GetDataBuilder |
getData()
Start a get data builder
|
String |
getNamespace()
Return the current namespace or "" if none
|
SchemaSet |
getSchemaSet()
Return this instance's schema set
|
CuratorFrameworkState |
getState()
Returns the state of this instance
|
Listenable<UnhandledErrorListener> |
getUnhandledErrorListenable()
Returns the listenable interface for unhandled errors
|
org.apache.curator.CuratorZookeeperClient |
getZookeeperClient()
Return the managed zookeeper client
|
CuratorTransaction |
inTransaction()
Deprecated.
use
transaction() instead |
boolean |
isStarted()
Deprecated.
use
getState() instead |
org.apache.curator.utils.EnsurePath |
newNamespaceAwareEnsurePath(String path)
Deprecated.
|
WatcherRemoveCuratorFramework |
newWatcherRemoveCuratorFramework()
Returns a facade of the current instance that tracks
watchers created and allows a one-shot removal of all watchers
via
WatcherRemoveCuratorFramework.removeWatchers() |
CuratorFramework |
nonNamespaceView()
Deprecated.
Since 2.9.0 - use
usingNamespace(java.lang.String) passing null |
default CompletableFuture<Void> |
postSafeNotify(Object monitorHolder)
Calls
#notifyAll() on the given object after first synchronizing on it. |
ReconfigBuilder |
reconfig()
Start a reconfig builder
|
CompletableFuture<Void> |
runSafe(Runnable runnable)
Curator (and user) recipes can use this to run notifyAll
and other blocking calls that might normally block ZooKeeper's event thread.
|
SetACLBuilder |
setACL()
Start a set ACL builder
|
SetDataBuilder |
setData()
Start a set data builder
|
void |
start()
Start the client.
|
SyncBuilder |
sync()
Start a sync builder.
|
void |
sync(String path,
Object backgroundContextObject)
Deprecated.
use
sync() instead |
CuratorMultiTransaction |
transaction()
Start a transaction builder
|
TransactionOp |
transactionOp()
Allocate an operation that can be used with
transaction() . |
CuratorFramework |
usingNamespace(String newNamespace)
Returns a facade of the current instance that uses the specified namespace
or no namespace if
newNamespace is null . |
WatchesBuilder |
watchers()
Start a watch builder.
|
RemoveWatchesBuilder |
watches()
Deprecated.
use
watchers() in ZooKeeper 3.6+ |
void start()
void close()
close
in interface AutoCloseable
close
in interface Closeable
CuratorFrameworkState getState()
@Deprecated boolean isStarted()
getState()
insteadCreateBuilder create()
DeleteBuilder delete()
ExistsBuilder checkExists()
The builder will return a Stat object as if org.apache.zookeeper.ZooKeeper.exists() were called. Thus, a null means that it does not exist and an actual Stat object means it does exist.
GetDataBuilder getData()
SetDataBuilder setData()
GetChildrenBuilder getChildren()
GetACLBuilder getACL()
SetACLBuilder setACL()
ReconfigBuilder reconfig()
GetConfigBuilder getConfig()
CuratorTransaction inTransaction()
transaction()
insteadCuratorMultiTransaction transaction()
TransactionOp transactionOp()
transaction()
.
NOTE: CuratorOp
instances created by this builder are
reusable.@Deprecated void sync(String path, Object backgroundContextObject)
sync()
insteadpath
- the pathbackgroundContextObject
- optional contextvoid createContainers(String path) throws Exception
path
- path to createException
- errorsSyncBuilder sync()
RemoveWatchesBuilder watches()
watchers()
in ZooKeeper 3.6+WatchesBuilder watchers()
IllegalStateException
for ZooKeeper JAR 3.5 or belowIllegalStateException
- ZooKeeper JAR is 3.5 or belowListenable<ConnectionStateListener> getConnectionStateListenable()
Listenable<CuratorListener> getCuratorListenable()
Listenable<UnhandledErrorListener> getUnhandledErrorListenable()
@Deprecated CuratorFramework nonNamespaceView()
usingNamespace(java.lang.String)
passing null
CuratorFramework usingNamespace(String newNamespace)
newNamespace
is null
.newNamespace
- the new namespace or null for noneString getNamespace()
org.apache.curator.CuratorZookeeperClient getZookeeperClient()
@Deprecated org.apache.curator.utils.EnsurePath newNamespaceAwareEnsurePath(String path)
CreateBuilderMain.creatingParentContainersIfNeeded()
, ExistsBuilder.creatingParentContainersIfNeeded()
or createContainers(String)
path
- path to ensure@Deprecated void clearWatcherReferences(org.apache.zookeeper.Watcher watcher)
newWatcherRemoveCuratorFramework()
calling WatcherRemoveCuratorFramework.removeWatchers()
when closing your instance.watcher
- the watcherboolean blockUntilConnected(int maxWaitTime, TimeUnit units) throws InterruptedException
maxWaitTime
- The maximum wait time.
1. value <= 0
and units != null
to return immediately;
2. value <= 0
and units == null
to wait indefinitely,
which is same as blockUntilConnected()
.units
- The time units for the maximum wait time.InterruptedException
- If interrupted while waitingvoid blockUntilConnected() throws InterruptedException
InterruptedException
- If interrupted while waitingWatcherRemoveCuratorFramework newWatcherRemoveCuratorFramework()
WatcherRemoveCuratorFramework.removeWatchers()
ConnectionStateErrorPolicy getConnectionStateErrorPolicy()
org.apache.zookeeper.server.quorum.flexible.QuorumVerifier getCurrentConfig()
SchemaSet getSchemaSet()
default CompletableFuture<Void> postSafeNotify(Object monitorHolder)
#notifyAll()
on the given object after first synchronizing on it. This is
done from the runSafe(Runnable)
thread.monitorHolder
- object to sync on and notifyCompletableFuture<Void> runSafe(Runnable runnable)
runnable
- proc to call from a safe internal threadCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.