public class Zookeeper extends Object
Constructor and Description |
---|
Zookeeper() |
Modifier and Type | Method and Description |
---|---|
static void |
addListener(org.apache.curator.framework.CuratorFramework zk,
org.apache.curator.framework.state.ConnectionStateListener listener) |
static String |
createNode(org.apache.curator.framework.CuratorFramework zk,
String path,
byte[] data,
org.apache.zookeeper.CreateMode mode,
List<org.apache.zookeeper.data.ACL> acls) |
static String |
createNode(org.apache.curator.framework.CuratorFramework zk,
String path,
byte[] data,
List<org.apache.zookeeper.data.ACL> acls) |
static void |
deleteNode(org.apache.curator.framework.CuratorFramework zk,
String path) |
static void |
deleteNodeBlobstore(org.apache.curator.framework.CuratorFramework zk,
String parentPath,
String hostPortInfo) |
static boolean |
exists(org.apache.curator.framework.CuratorFramework zk,
String path,
boolean watch) |
static boolean |
existsNode(org.apache.curator.framework.CuratorFramework zk,
String path,
boolean watch) |
static List<String> |
getChildren(org.apache.curator.framework.CuratorFramework zk,
String path,
boolean watch) |
static byte[] |
getData(org.apache.curator.framework.CuratorFramework zk,
String path,
boolean watch) |
static VersionedData<byte[]> |
getDataWithVersion(org.apache.curator.framework.CuratorFramework zk,
String path,
boolean watch)
Get the data along with a version
|
static Integer |
getVersion(org.apache.curator.framework.CuratorFramework zk,
String path,
boolean watch) |
static org.apache.curator.framework.recipes.leader.LeaderLatchListener |
leaderLatchListenerImpl(Map conf,
org.apache.curator.framework.CuratorFramework zk,
BlobStore blobStore,
org.apache.curator.framework.recipes.leader.LeaderLatch leaderLatch) |
static org.apache.curator.framework.CuratorFramework |
mkClient(Map conf,
List<String> servers,
Object port,
String root,
WatcherCallBack watcher,
Map authConf,
List<org.apache.zookeeper.data.ACL> defaultAcl) |
org.apache.curator.framework.CuratorFramework |
mkClientImpl(Map conf,
List<String> servers,
Object port,
Map authConf,
List<org.apache.zookeeper.data.ACL> defaultAcl) |
org.apache.curator.framework.CuratorFramework |
mkClientImpl(Map conf,
List<String> servers,
Object port,
String root,
List<org.apache.zookeeper.data.ACL> defaultAcl) |
org.apache.curator.framework.CuratorFramework |
mkClientImpl(Map conf,
List<String> servers,
Object port,
String root,
Map authConf,
List<org.apache.zookeeper.data.ACL> defaultAcl) |
org.apache.curator.framework.CuratorFramework |
mkClientImpl(Map conf,
List<String> servers,
Object port,
String root,
WatcherCallBack watcher,
List<org.apache.zookeeper.data.ACL> defaultAcl)
connect ZK, register Watch/unhandle Watch
|
org.apache.curator.framework.CuratorFramework |
mkClientImpl(Map conf,
List<String> servers,
Object port,
String root,
WatcherCallBack watcher,
Map authConf,
List<org.apache.zookeeper.data.ACL> defaultAcl) |
static void |
mkdirs(org.apache.curator.framework.CuratorFramework zk,
String path,
List<org.apache.zookeeper.data.ACL> acls) |
void |
mkdirsImpl(org.apache.curator.framework.CuratorFramework zk,
String path,
List<org.apache.zookeeper.data.ACL> acls) |
static List |
mkInprocessZookeeper(String localdir,
Integer port) |
static String |
normalizePath(String path) |
static String |
parentPath(String path) |
static void |
resetInstance()
Resets the singleton instance to the default.
|
static org.apache.zookeeper.data.Stat |
setData(org.apache.curator.framework.CuratorFramework zk,
String path,
byte[] data) |
static void |
setInstance(Zookeeper u)
Provide an instance of this class for delegates to use.
|
static void |
shutdownInprocessZookeeper(org.apache.zookeeper.server.NIOServerCnxnFactory handle) |
static void |
syncPath(org.apache.curator.framework.CuratorFramework zk,
String path) |
static List<String> |
tokenizePath(String path) |
static String |
toksToPath(List<String> toks) |
static NimbusInfo |
toNimbusInfo(org.apache.curator.framework.recipes.leader.Participant participant) |
static ILeaderElector |
zkLeaderElector(Map conf,
org.apache.curator.framework.CuratorFramework zkClient,
BlobStore blobStore)
Get master leader elector.
|
protected ILeaderElector |
zkLeaderElectorImpl(Map conf,
org.apache.curator.framework.CuratorFramework zk,
BlobStore blobStore) |
public static void setInstance(Zookeeper u)
Provide an instance of this class for delegates to use. To mock out delegated methods, provide an instance of a subclass that overrides the implementation of the delegated method.
u
- a Zookeeper instancepublic static void resetInstance()
Resets the singleton instance to the default. This is helpful to reset the class to its original functionality when mocking is no longer desired.
public org.apache.curator.framework.CuratorFramework mkClientImpl(Map conf, List<String> servers, Object port, String root, List<org.apache.zookeeper.data.ACL> defaultAcl)
public org.apache.curator.framework.CuratorFramework mkClientImpl(Map conf, List<String> servers, Object port, Map authConf, List<org.apache.zookeeper.data.ACL> defaultAcl)
public org.apache.curator.framework.CuratorFramework mkClientImpl(Map conf, List<String> servers, Object port, String root, Map authConf, List<org.apache.zookeeper.data.ACL> defaultAcl)
public static org.apache.curator.framework.CuratorFramework mkClient(Map conf, List<String> servers, Object port, String root, WatcherCallBack watcher, Map authConf, List<org.apache.zookeeper.data.ACL> defaultAcl)
public org.apache.curator.framework.CuratorFramework mkClientImpl(Map conf, List<String> servers, Object port, String root, WatcherCallBack watcher, Map authConf, List<org.apache.zookeeper.data.ACL> defaultAcl)
public org.apache.curator.framework.CuratorFramework mkClientImpl(Map conf, List<String> servers, Object port, String root, WatcherCallBack watcher, List<org.apache.zookeeper.data.ACL> defaultAcl)
connect ZK, register Watch/unhandle Watch
public static String createNode(org.apache.curator.framework.CuratorFramework zk, String path, byte[] data, org.apache.zookeeper.CreateMode mode, List<org.apache.zookeeper.data.ACL> acls)
public static String createNode(org.apache.curator.framework.CuratorFramework zk, String path, byte[] data, List<org.apache.zookeeper.data.ACL> acls)
public static boolean existsNode(org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
public static void deleteNode(org.apache.curator.framework.CuratorFramework zk, String path)
public static void mkdirs(org.apache.curator.framework.CuratorFramework zk, String path, List<org.apache.zookeeper.data.ACL> acls)
public void mkdirsImpl(org.apache.curator.framework.CuratorFramework zk, String path, List<org.apache.zookeeper.data.ACL> acls)
public static void syncPath(org.apache.curator.framework.CuratorFramework zk, String path)
public static void addListener(org.apache.curator.framework.CuratorFramework zk, org.apache.curator.framework.state.ConnectionStateListener listener)
public static byte[] getData(org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
public static Integer getVersion(org.apache.curator.framework.CuratorFramework zk, String path, boolean watch) throws Exception
Exception
public static List<String> getChildren(org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
public static void deleteNodeBlobstore(org.apache.curator.framework.CuratorFramework zk, String parentPath, String hostPortInfo)
public static org.apache.zookeeper.data.Stat setData(org.apache.curator.framework.CuratorFramework zk, String path, byte[] data)
public static boolean exists(org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
public static List mkInprocessZookeeper(String localdir, Integer port) throws Exception
Exception
public static void shutdownInprocessZookeeper(org.apache.zookeeper.server.NIOServerCnxnFactory handle)
public static NimbusInfo toNimbusInfo(org.apache.curator.framework.recipes.leader.Participant participant)
public static org.apache.curator.framework.recipes.leader.LeaderLatchListener leaderLatchListenerImpl(Map conf, org.apache.curator.framework.CuratorFramework zk, BlobStore blobStore, org.apache.curator.framework.recipes.leader.LeaderLatch leaderLatch) throws UnknownHostException
UnknownHostException
public static ILeaderElector zkLeaderElector(Map conf, org.apache.curator.framework.CuratorFramework zkClient, BlobStore blobStore) throws UnknownHostException
Get master leader elector.
conf
- Config.zkClient
- ZkClient, the client must have a default Config.STORM_ZOOKEEPER_ROOT as root path.blobStore
- BlobStore
ILeaderElector
UnknownHostException
protected ILeaderElector zkLeaderElectorImpl(Map conf, org.apache.curator.framework.CuratorFramework zk, BlobStore blobStore) throws UnknownHostException
UnknownHostException
public static VersionedData<byte[]> getDataWithVersion(org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
Get the data along with a version
zk
- the zk instance to usepath
- the path to get it fromwatch
- should a watch be enabledCopyright © 2019 The Apache Software Foundation. All Rights Reserved.