Class CuratorFrameworkImpl
java.lang.Object
org.apache.curator.framework.imps.CuratorFrameworkImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,CuratorFramework
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionvoidBlock until a connection to ZooKeeper is available.booleanblockUntilConnected(int maxWaitTime, TimeUnit units) Block until a connection to ZooKeeper is available or the maxWaitTime has been exceededStart an exists buildervoidclearWatcherReferences(org.apache.zookeeper.Watcher watcher) Curator can hold internal references to watchers that may inhibit garbage collection.voidclose()Stop the clientcreate()Start a create buildervoidcreateContainers(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.QuorumVerifierCurrent 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 errorsorg.apache.curator.CuratorZookeeperClientReturn the managed zookeeper clientprotected voidinternalSync(CuratorFrameworkImpl impl, String path, Object context) Start a transaction builderbooleanDeprecated.org.apache.curator.utils.EnsurePathAllocates 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 buildervoidstart()Start the client.sync()Start a sync builder.voidPerform 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 ifnewNamespaceisnull.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, waitMethods inherited from interface org.apache.curator.framework.CuratorFramework
postSafeNotify
-
Field Details
-
debugUnhandledErrorListener
-
-
Constructor Details
-
CuratorFrameworkImpl
-
CuratorFrameworkImpl
-
-
Method Details
-
runSafe
Description copied from interface:CuratorFrameworkCurator (and user) recipes can use this to run notifyAll and other blocking calls that might normally block ZooKeeper's event thread.- Specified by:
runSafein 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:CuratorFrameworkReturns a facade of the current instance that tracks watchers created and allows a one-shot removal of all watchers viaWatcherRemoveCuratorFramework.removeWatchers()- Specified by:
newWatcherRemoveCuratorFrameworkin interfaceCuratorFramework- Returns:
- facade
-
getCurrentConfig
public org.apache.zookeeper.server.quorum.flexible.QuorumVerifier getCurrentConfig()Description copied from interface:CuratorFrameworkCurrent maintains a cached view of the Zookeeper quorum config.- Specified by:
getCurrentConfigin interfaceCuratorFramework- Returns:
- the current config
-
createContainers
Description copied from interface:CuratorFrameworkCreate all nodes in the specified path as containers if they don't already exist- Specified by:
createContainersin interfaceCuratorFramework- Parameters:
path- path to create- Throws:
Exception- errors
-
clearWatcherReferences
public void clearWatcherReferences(org.apache.zookeeper.Watcher watcher) Description copied from interface:CuratorFrameworkCurator can hold internal references to watchers that may inhibit garbage collection. Call this method on watchers you are no longer interested in.- Specified by:
clearWatcherReferencesin interfaceCuratorFramework- Parameters:
watcher- the watcher
-
getState
Description copied from interface:CuratorFrameworkReturns the state of this instance- Specified by:
getStatein interfaceCuratorFramework- Returns:
- state
-
isStarted
Deprecated.Description copied from interface:CuratorFrameworkReturn true if the client is started, not closed, etc.- Specified by:
isStartedin interfaceCuratorFramework- Returns:
- true/false
-
blockUntilConnected
Description copied from interface:CuratorFrameworkBlock until a connection to ZooKeeper is available or the maxWaitTime has been exceeded- Specified by:
blockUntilConnectedin interfaceCuratorFramework- Parameters:
maxWaitTime- The maximum wait time. 1.value <= 0andunits != nullto return immediately; 2.value <= 0andunits == nullto 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:CuratorFrameworkBlock 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:
blockUntilConnectedin interfaceCuratorFramework- Throws:
InterruptedException- If interrupted while waiting
-
getConnectionStateErrorPolicy
Description copied from interface:CuratorFrameworkReturn the configured error policy- Specified by:
getConnectionStateErrorPolicyin interfaceCuratorFramework- Returns:
- error policy
-
start
public void start()Description copied from interface:CuratorFrameworkStart the client. Most mutator methods will not work until the client is started- Specified by:
startin interfaceCuratorFramework
-
close
public void close()Description copied from interface:CuratorFrameworkStop the client- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCuratorFramework
-
nonNamespaceView
Deprecated.Description copied from interface:CuratorFrameworkReturns a facade of the current instance that does _not_ automatically pre-pend the namespace to all paths- Specified by:
nonNamespaceViewin interfaceCuratorFramework- Returns:
- facade
-
getNamespace
Description copied from interface:CuratorFrameworkReturn the current namespace or "" if none- Specified by:
getNamespacein interfaceCuratorFramework- Returns:
- namespace
-
usingNamespace
Description copied from interface:CuratorFrameworkReturns a facade of the current instance that uses the specified namespace or no namespace ifnewNamespaceisnull.- Specified by:
usingNamespacein interfaceCuratorFramework- Parameters:
newNamespace- the new namespace or null for none- Returns:
- facade
-
create
Description copied from interface:CuratorFrameworkStart a create builder- Specified by:
createin interfaceCuratorFramework- Returns:
- builder object
-
delete
Description copied from interface:CuratorFrameworkStart a delete builder- Specified by:
deletein interfaceCuratorFramework- Returns:
- builder object
-
checkExists
Description copied from interface:CuratorFrameworkStart 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:
checkExistsin interfaceCuratorFramework- Returns:
- builder object
-
getData
Description copied from interface:CuratorFrameworkStart a get data builder- Specified by:
getDatain interfaceCuratorFramework- Returns:
- builder object
-
setData
Description copied from interface:CuratorFrameworkStart a set data builder- Specified by:
setDatain interfaceCuratorFramework- Returns:
- builder object
-
getChildren
Description copied from interface:CuratorFrameworkStart a get children builder- Specified by:
getChildrenin interfaceCuratorFramework- Returns:
- builder object
-
getACL
Description copied from interface:CuratorFrameworkStart a get ACL builder- Specified by:
getACLin interfaceCuratorFramework- Returns:
- builder object
-
setACL
Description copied from interface:CuratorFrameworkStart a set ACL builder- Specified by:
setACLin interfaceCuratorFramework- Returns:
- builder object
-
reconfig
Description copied from interface:CuratorFrameworkStart a reconfig builder- Specified by:
reconfigin interfaceCuratorFramework- Returns:
- builder object
-
getConfig
Description copied from interface:CuratorFrameworkStart a getConfig builder- Specified by:
getConfigin interfaceCuratorFramework- Returns:
- builder object
-
inTransaction
Description copied from interface:CuratorFrameworkStart a transaction builder- Specified by:
inTransactionin interfaceCuratorFramework- Returns:
- builder object
-
transaction
Description copied from interface:CuratorFrameworkStart a transaction builder- Specified by:
transactionin interfaceCuratorFramework- Returns:
- builder object
-
transactionOp
Description copied from interface:CuratorFrameworkAllocate an operation that can be used withCuratorFramework.transaction(). NOTE:CuratorOpinstances created by this builder are reusable.- Specified by:
transactionOpin interfaceCuratorFramework- Returns:
- operation builder
-
getConnectionStateListenable
Description copied from interface:CuratorFrameworkReturns the listenable interface for the Connect State- Specified by:
getConnectionStateListenablein interfaceCuratorFramework- Returns:
- listenable
-
getCuratorListenable
Description copied from interface:CuratorFrameworkReturns the listenable interface for events- Specified by:
getCuratorListenablein interfaceCuratorFramework- Returns:
- listenable
-
getUnhandledErrorListenable
Description copied from interface:CuratorFrameworkReturns the listenable interface for unhandled errors- Specified by:
getUnhandledErrorListenablein interfaceCuratorFramework- Returns:
- listenable
-
sync
Description copied from interface:CuratorFrameworkPerform a sync on the given path - syncs are always in the background- Specified by:
syncin interfaceCuratorFramework- Parameters:
path- the pathcontext- optional context
-
sync
Description copied from interface:CuratorFrameworkStart a sync builder. Note: sync is ALWAYS in the background even if you don't use one of the background() methods- Specified by:
syncin interfaceCuratorFramework- Returns:
- builder object
-
watches
Description copied from interface:CuratorFrameworkStart a remove watches builder.- Specified by:
watchesin interfaceCuratorFramework- Returns:
- builder object
-
watchers
Description copied from interface:CuratorFrameworkStart a watch builder. Supported only when ZooKeeper JAR of version 3.6 or above is used, throwsIllegalStateExceptionfor ZooKeeper JAR 3.5 or below- Specified by:
watchersin interfaceCuratorFramework- Returns:
- builder object
-
internalSync
-
getZookeeperClient
public org.apache.curator.CuratorZookeeperClient getZookeeperClient()Description copied from interface:CuratorFrameworkReturn the managed zookeeper client- Specified by:
getZookeeperClientin interfaceCuratorFramework- Returns:
- client
-
newNamespaceAwareEnsurePath
Description copied from interface:CuratorFrameworkAllocates an ensure path instance that is namespace aware- Specified by:
newNamespaceAwareEnsurePathin interfaceCuratorFramework- Parameters:
path- path to ensure- Returns:
- new EnsurePath instance
-
getSchemaSet
Description copied from interface:CuratorFrameworkReturn this instance's schema set- Specified by:
getSchemaSetin interfaceCuratorFramework- Returns:
- schema set
-