public class CuratorFrameworkImpl extends Object implements CuratorFramework
Modifier and Type | Field and Description |
---|---|
UnhandledErrorListener |
debugUnhandledErrorListener |
Modifier | Constructor and Description |
---|---|
|
CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder) |
protected |
CuratorFrameworkImpl(CuratorFrameworkImpl parent) |
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)
Curator can hold internal references to watchers that may inhibit garbage collection.
|
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
|
CuratorZookeeperClient |
getZookeeperClient()
Return the managed zookeeper client
|
protected void |
internalSync(CuratorFrameworkImpl impl,
String path,
Object context) |
CuratorTransaction |
inTransaction()
Start a transaction builder
|
boolean |
isStarted()
Deprecated.
|
EnsurePath |
newNamespaceAwareEnsurePath(String path)
Allocates an ensure path instance that is namespace aware
|
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.
|
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 context)
Perform a sync on the given path - syncs are always in the background
|
CuratorMultiTransaction |
transaction()
Start a transaction builder
|
TransactionOp |
transactionOp()
Allocate an operation that can be used with
CuratorFramework.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()
Start a remove watches builder.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
postSafeNotify
public volatile UnhandledErrorListener debugUnhandledErrorListener
public CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder)
protected CuratorFrameworkImpl(CuratorFrameworkImpl parent)
public CompletableFuture<Void> runSafe(Runnable runnable)
CuratorFramework
runSafe
in interface CuratorFramework
runnable
- proc to call from a safe internal threadpublic WatcherRemoveCuratorFramework newWatcherRemoveCuratorFramework()
CuratorFramework
WatcherRemoveCuratorFramework.removeWatchers()
newWatcherRemoveCuratorFramework
in interface CuratorFramework
public org.apache.zookeeper.server.quorum.flexible.QuorumVerifier getCurrentConfig()
CuratorFramework
getCurrentConfig
in interface CuratorFramework
public void createContainers(String path) throws Exception
CuratorFramework
createContainers
in interface CuratorFramework
path
- path to createException
- errorspublic void clearWatcherReferences(org.apache.zookeeper.Watcher watcher)
CuratorFramework
clearWatcherReferences
in interface CuratorFramework
watcher
- the watcherpublic CuratorFrameworkState getState()
CuratorFramework
getState
in interface CuratorFramework
@Deprecated public boolean isStarted()
CuratorFramework
isStarted
in interface CuratorFramework
public boolean blockUntilConnected(int maxWaitTime, TimeUnit units) throws InterruptedException
CuratorFramework
blockUntilConnected
in interface CuratorFramework
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 CuratorFramework.blockUntilConnected()
.units
- The time units for the maximum wait time.InterruptedException
- If interrupted while waitingpublic void blockUntilConnected() throws InterruptedException
CuratorFramework
blockUntilConnected
in interface CuratorFramework
InterruptedException
- If interrupted while waitingpublic ConnectionStateErrorPolicy getConnectionStateErrorPolicy()
CuratorFramework
getConnectionStateErrorPolicy
in interface CuratorFramework
public void start()
CuratorFramework
start
in interface CuratorFramework
public void close()
CuratorFramework
close
in interface Closeable
close
in interface AutoCloseable
close
in interface CuratorFramework
@Deprecated public CuratorFramework nonNamespaceView()
CuratorFramework
nonNamespaceView
in interface CuratorFramework
public String getNamespace()
CuratorFramework
getNamespace
in interface CuratorFramework
public CuratorFramework usingNamespace(String newNamespace)
CuratorFramework
newNamespace
is null
.usingNamespace
in interface CuratorFramework
newNamespace
- the new namespace or null for nonepublic CreateBuilder create()
CuratorFramework
create
in interface CuratorFramework
public DeleteBuilder delete()
CuratorFramework
delete
in interface CuratorFramework
public ExistsBuilder checkExists()
CuratorFramework
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.
checkExists
in interface CuratorFramework
public GetDataBuilder getData()
CuratorFramework
getData
in interface CuratorFramework
public SetDataBuilder setData()
CuratorFramework
setData
in interface CuratorFramework
public GetChildrenBuilder getChildren()
CuratorFramework
getChildren
in interface CuratorFramework
public GetACLBuilder getACL()
CuratorFramework
getACL
in interface CuratorFramework
public SetACLBuilder setACL()
CuratorFramework
setACL
in interface CuratorFramework
public ReconfigBuilder reconfig()
CuratorFramework
reconfig
in interface CuratorFramework
public GetConfigBuilder getConfig()
CuratorFramework
getConfig
in interface CuratorFramework
public CuratorTransaction inTransaction()
CuratorFramework
inTransaction
in interface CuratorFramework
public CuratorMultiTransaction transaction()
CuratorFramework
transaction
in interface CuratorFramework
public TransactionOp transactionOp()
CuratorFramework
CuratorFramework.transaction()
.
NOTE: CuratorOp
instances created by this builder are
reusable.transactionOp
in interface CuratorFramework
public Listenable<ConnectionStateListener> getConnectionStateListenable()
CuratorFramework
getConnectionStateListenable
in interface CuratorFramework
public Listenable<CuratorListener> getCuratorListenable()
CuratorFramework
getCuratorListenable
in interface CuratorFramework
public Listenable<UnhandledErrorListener> getUnhandledErrorListenable()
CuratorFramework
getUnhandledErrorListenable
in interface CuratorFramework
public void sync(String path, Object context)
CuratorFramework
sync
in interface CuratorFramework
path
- the pathcontext
- optional contextpublic SyncBuilder sync()
CuratorFramework
sync
in interface CuratorFramework
public RemoveWatchesBuilder watches()
CuratorFramework
watches
in interface CuratorFramework
public WatchesBuilder watchers()
CuratorFramework
IllegalStateException
for ZooKeeper JAR 3.5 or belowwatchers
in interface CuratorFramework
protected void internalSync(CuratorFrameworkImpl impl, String path, Object context)
public CuratorZookeeperClient getZookeeperClient()
CuratorFramework
getZookeeperClient
in interface CuratorFramework
public EnsurePath newNamespaceAwareEnsurePath(String path)
CuratorFramework
newNamespaceAwareEnsurePath
in interface CuratorFramework
path
- path to ensurepublic SchemaSet getSchemaSet()
CuratorFramework
getSchemaSet
in interface CuratorFramework
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.