Class CuratorFrameworkImpl
java.lang.Object
org.apache.curator.framework.imps.CuratorFrameworkImpl
- All Implemented Interfaces:
Closeable
,AutoCloseable
,CuratorFramework
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 exceededStart an exists buildervoid
clearWatcherReferences
(org.apache.zookeeper.Watcher watcher) Curator can hold internal references to watchers that may inhibit garbage collection.void
close()
Stop the clientcreate()
Start a create buildervoid
createContainers
(String path) Create all nodes in the specified path as containers if they don't already existdelete()
Start a delete buildergetACL()
Start a get ACL builderStart a get children builderStart a getConfig builderReturn the configured error policyReturns the listenable interface for the Connect StateReturns the listenable interface for eventsorg.apache.zookeeper.server.quorum.flexible.QuorumVerifier
Current maintains a cached view of the Zookeeper quorum config.getData()
Start a get data builderReturn the current namespace or "" if noneReturn this instance's schema setgetState()
Returns the state of this instanceReturns the listenable interface for unhandled errorsReturn the managed zookeeper clientReturn zookeeper server compatibilityprotected void
internalSync
(CuratorFrameworkImpl impl, String path, Object context) Start a transaction builderboolean
Deprecated.Allocates an ensure path instance that is namespace awareReturns a facade of the current instance that tracks watchers created and allows a one-shot removal of all watchers viaWatcherRemoveCuratorFramework.removeWatchers()
Deprecated.reconfig()
Start a reconfig builderCurator (and user) recipes can use this to run notifyAll and other blocking calls that might normally block ZooKeeper's event thread.setACL()
Start a set ACL buildersetData()
Start a set data buildervoid
start()
Start the client.sync()
Start a sync builder.void
Perform a sync on the given path - syncs are always in the backgroundStart a transaction builderAllocate an operation that can be used withCuratorFramework.transaction()
.usingNamespace
(String newNamespace) Returns a facade of the current instance that uses the specified namespace or no namespace ifnewNamespace
isnull
.watchers()
Start a watch builder.watches()
Start a remove watches builder.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.curator.framework.CuratorFramework
postSafeNotify
-
Field Details
-
debugUnhandledErrorListener
-
-
Constructor Details
-
CuratorFrameworkImpl
-
CuratorFrameworkImpl
-
-
Method Details
-
runSafe
Description copied from interface:CuratorFramework
Curator (and user) recipes can use this to run notifyAll and other blocking calls that might normally block ZooKeeper's event thread.- Specified by:
runSafe
in interfaceCuratorFramework
- Parameters:
runnable
- proc to call from a safe internal thread- Returns:
- a CompletableFuture that can be used to monitor when the call is complete
-
newWatcherRemoveCuratorFramework
Description copied from interface:CuratorFramework
Returns a facade of the current instance that tracks watchers created and allows a one-shot removal of all watchers viaWatcherRemoveCuratorFramework.removeWatchers()
- Specified by:
newWatcherRemoveCuratorFramework
in interfaceCuratorFramework
- Returns:
- facade
-
getCurrentConfig
public org.apache.zookeeper.server.quorum.flexible.QuorumVerifier getCurrentConfig()Description copied from interface:CuratorFramework
Current maintains a cached view of the Zookeeper quorum config.- Specified by:
getCurrentConfig
in interfaceCuratorFramework
- Returns:
- the current config
-
createContainers
Description copied from interface:CuratorFramework
Create all nodes in the specified path as containers if they don't already exist- Specified by:
createContainers
in interfaceCuratorFramework
- Parameters:
path
- path to create- Throws:
Exception
- errors
-
clearWatcherReferences
public void clearWatcherReferences(org.apache.zookeeper.Watcher watcher) Description copied from interface:CuratorFramework
Curator can hold internal references to watchers that may inhibit garbage collection. Call this method on watchers you are no longer interested in.- Specified by:
clearWatcherReferences
in interfaceCuratorFramework
- Parameters:
watcher
- the watcher
-
getState
Description copied from interface:CuratorFramework
Returns the state of this instance- Specified by:
getState
in interfaceCuratorFramework
- Returns:
- state
-
isStarted
Deprecated.Description copied from interface:CuratorFramework
Return true if the client is started, not closed, etc.- Specified by:
isStarted
in interfaceCuratorFramework
- Returns:
- true/false
-
blockUntilConnected
Description copied from interface:CuratorFramework
Block until a connection to ZooKeeper is available or the maxWaitTime has been exceeded- Specified by:
blockUntilConnected
in interfaceCuratorFramework
- Parameters:
maxWaitTime
- The maximum wait time. 1.value <= 0
andunits != null
to return immediately; 2.value <= 0
andunits == null
to wait indefinitely, which is same asCuratorFramework.blockUntilConnected()
.units
- The time units for the maximum wait time.- Returns:
- True if connection has been established, false otherwise.
- Throws:
InterruptedException
- If interrupted while waiting
-
blockUntilConnected
Description copied from interface:CuratorFramework
Block until a connection to ZooKeeper is available. This method will not return until a connection is available, or it is interrupted, in which case an InterruptedException will be thrown- Specified by:
blockUntilConnected
in interfaceCuratorFramework
- Throws:
InterruptedException
- If interrupted while waiting
-
getConnectionStateErrorPolicy
Description copied from interface:CuratorFramework
Return the configured error policy- Specified by:
getConnectionStateErrorPolicy
in interfaceCuratorFramework
- Returns:
- error policy
-
start
public void start()Description copied from interface:CuratorFramework
Start the client. Most mutator methods will not work until the client is started- Specified by:
start
in interfaceCuratorFramework
-
close
public void close()Description copied from interface:CuratorFramework
Stop the client- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCuratorFramework
-
nonNamespaceView
Deprecated.Description copied from interface:CuratorFramework
Returns a facade of the current instance that does _not_ automatically pre-pend the namespace to all paths- Specified by:
nonNamespaceView
in interfaceCuratorFramework
- Returns:
- facade
-
getNamespace
Description copied from interface:CuratorFramework
Return the current namespace or "" if none- Specified by:
getNamespace
in interfaceCuratorFramework
- Returns:
- namespace
-
usingNamespace
Description copied from interface:CuratorFramework
Returns a facade of the current instance that uses the specified namespace or no namespace ifnewNamespace
isnull
.- Specified by:
usingNamespace
in interfaceCuratorFramework
- Parameters:
newNamespace
- the new namespace or null for none- Returns:
- facade
-
create
Description copied from interface:CuratorFramework
Start a create builder- Specified by:
create
in interfaceCuratorFramework
- Returns:
- builder object
-
delete
Description copied from interface:CuratorFramework
Start a delete builder- Specified by:
delete
in interfaceCuratorFramework
- Returns:
- builder object
-
checkExists
Description copied from interface:CuratorFramework
Start an exists builderThe 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.
- Specified by:
checkExists
in interfaceCuratorFramework
- Returns:
- builder object
-
getData
Description copied from interface:CuratorFramework
Start a get data builder- Specified by:
getData
in interfaceCuratorFramework
- Returns:
- builder object
-
setData
Description copied from interface:CuratorFramework
Start a set data builder- Specified by:
setData
in interfaceCuratorFramework
- Returns:
- builder object
-
getChildren
Description copied from interface:CuratorFramework
Start a get children builder- Specified by:
getChildren
in interfaceCuratorFramework
- Returns:
- builder object
-
getACL
Description copied from interface:CuratorFramework
Start a get ACL builder- Specified by:
getACL
in interfaceCuratorFramework
- Returns:
- builder object
-
setACL
Description copied from interface:CuratorFramework
Start a set ACL builder- Specified by:
setACL
in interfaceCuratorFramework
- Returns:
- builder object
-
reconfig
Description copied from interface:CuratorFramework
Start a reconfig builder- Specified by:
reconfig
in interfaceCuratorFramework
- Returns:
- builder object
-
getConfig
Description copied from interface:CuratorFramework
Start a getConfig builder- Specified by:
getConfig
in interfaceCuratorFramework
- Returns:
- builder object
-
inTransaction
Description copied from interface:CuratorFramework
Start a transaction builder- Specified by:
inTransaction
in interfaceCuratorFramework
- Returns:
- builder object
-
transaction
Description copied from interface:CuratorFramework
Start a transaction builder- Specified by:
transaction
in interfaceCuratorFramework
- Returns:
- builder object
-
transactionOp
Description copied from interface:CuratorFramework
Allocate an operation that can be used withCuratorFramework.transaction()
. NOTE:CuratorOp
instances created by this builder are reusable.- Specified by:
transactionOp
in interfaceCuratorFramework
- Returns:
- operation builder
-
getConnectionStateListenable
Description copied from interface:CuratorFramework
Returns the listenable interface for the Connect State- Specified by:
getConnectionStateListenable
in interfaceCuratorFramework
- Returns:
- listenable
-
getCuratorListenable
Description copied from interface:CuratorFramework
Returns the listenable interface for events- Specified by:
getCuratorListenable
in interfaceCuratorFramework
- Returns:
- listenable
-
getUnhandledErrorListenable
Description copied from interface:CuratorFramework
Returns the listenable interface for unhandled errors- Specified by:
getUnhandledErrorListenable
in interfaceCuratorFramework
- Returns:
- listenable
-
sync
Description copied from interface:CuratorFramework
Perform a sync on the given path - syncs are always in the background- Specified by:
sync
in interfaceCuratorFramework
- Parameters:
path
- the pathcontext
- optional context
-
sync
Description copied from interface:CuratorFramework
Start a sync builder. Note: sync is ALWAYS in the background even if you don't use one of the background() methods- Specified by:
sync
in interfaceCuratorFramework
- Returns:
- builder object
-
watches
Description copied from interface:CuratorFramework
Start a remove watches builder.- Specified by:
watches
in interfaceCuratorFramework
- Returns:
- builder object
-
watchers
Description copied from interface:CuratorFramework
Start a watch builder. Supported only when ZooKeeper JAR of version 3.6 or above is used, throwsIllegalStateException
for ZooKeeper JAR 3.5 or below- Specified by:
watchers
in interfaceCuratorFramework
- Returns:
- builder object
-
internalSync
-
getZookeeperClient
Description copied from interface:CuratorFramework
Return the managed zookeeper client- Specified by:
getZookeeperClient
in interfaceCuratorFramework
- Returns:
- client
-
getZookeeperCompatibility
Description copied from interface:CuratorFramework
Return zookeeper server compatibility- Specified by:
getZookeeperCompatibility
in interfaceCuratorFramework
- Returns:
- compatibility
-
newNamespaceAwareEnsurePath
Description copied from interface:CuratorFramework
Allocates an ensure path instance that is namespace aware- Specified by:
newNamespaceAwareEnsurePath
in interfaceCuratorFramework
- Parameters:
path
- path to ensure- Returns:
- new EnsurePath instance
-
getSchemaSet
Description copied from interface:CuratorFramework
Return this instance's schema set- Specified by:
getSchemaSet
in interfaceCuratorFramework
- Returns:
- schema set
-