public class ZooKeeperUtilityFactory extends Object
CuratorFramework
dependency. The
curator framework is cached in this instance and shared among all created ZooKeeper utility
instances. This requires that the utility classes DO NOT close the provided curator framework.
The curator framework is closed by calling the close(boolean)
method.
Constructor and Description |
---|
ZooKeeperUtilityFactory(Configuration configuration,
String path) |
Modifier and Type | Method and Description |
---|---|
void |
close(boolean cleanup)
Closes the ZooKeeperUtilityFactory.
|
ZooKeeperSharedCount |
createSharedCount(String path,
int seedCount)
Creates a
ZooKeeperSharedCount to store a shared count between multiple instances. |
ZooKeeperSharedValue |
createSharedValue(String path,
byte[] seedValue)
Creates a
ZooKeeperSharedValue to store a shared value between multiple instances. |
<T extends Serializable> |
createZooKeeperStateHandleStore(String zkStateHandleStorePath,
RetrievableStateStorageHelper<T> stateStorageHelper)
Creates a
ZooKeeperStateHandleStore instance with the provided arguments. |
public ZooKeeperUtilityFactory(Configuration configuration, String path) throws Exception
Exception
public void close(boolean cleanup) throws Exception
CuratorFramework
instance. If cleanup is true, then the initial path and all its children are deleted.cleanup
- deletes the initial path and all of its children to clean upException
- when deleting the znodespublic <T extends Serializable> ZooKeeperStateHandleStore<T> createZooKeeperStateHandleStore(String zkStateHandleStorePath, RetrievableStateStorageHelper<T> stateStorageHelper) throws Exception
ZooKeeperStateHandleStore
instance with the provided arguments.T
- Type of the state to be storedzkStateHandleStorePath
- specifying the path in ZooKeeper to store the state handles tostateStorageHelper
- storing the actual state dataException
- if ZooKeeper could not create the provided state handle store path in
ZooKeeperpublic ZooKeeperSharedValue createSharedValue(String path, byte[] seedValue)
ZooKeeperSharedValue
to store a shared value between multiple instances.path
- to the shared value in ZooKeeperseedValue
- for the shared valuepublic ZooKeeperSharedCount createSharedCount(String path, int seedCount)
ZooKeeperSharedCount
to store a shared count between multiple instances.path
- to the shared count in ZooKeeperseedCount
- for the shared countCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.