public class JEtcdClient extends AbstractEtcdClient<JEtcdClient.EtcdWatcher>
| 限定符和类型 | 类和说明 |
|---|---|
class |
JEtcdClient.EtcdWatcher |
| 构造器和说明 |
|---|
JEtcdClient(URL url) |
| 限定符和类型 | 方法和说明 |
|---|---|
List<String> |
addChildWatcherListener(String path,
JEtcdClient.EtcdWatcher etcdWatcher) |
boolean |
checkExists(String path) |
JEtcdClient.EtcdWatcher |
createChildWatcherListener(String path,
ChildListener listener) |
long |
createLease(long second)
create new lease from specified second ,it should be waiting if failed.
|
long |
createLease(long ttl,
long timeout,
TimeUnit unit)
create new lease from specified ttl second before waiting specified timeout.
|
void |
delete(String path)
remove the specified from etcd registry.
|
void |
doClose() |
long |
doCreateEphemeral(String path) |
void |
doCreatePersistent(String path) |
io.grpc.ManagedChannel |
getChannel() |
List<String> |
getChildren(String path)
find direct children directory, excluding path self,
Never return null.
|
String |
getKVValue(String key)
Get the value of the specified key.
|
boolean |
isConnected()
test if current client is active.
|
boolean |
put(String key,
String value)
Put the key value pair to etcd
|
boolean |
putEphemeral(String key,
String value)
Put the key value pair to etcd (Ephemeral)
|
void |
removeChildWatcherListener(String path,
JEtcdClient.EtcdWatcher etcdWatcher) |
void |
revokeLease(long lease)
revoke specified lease, any associated path will removed automatically.
|
addChildListener, addStateListener, close, create, createEphemeral, getChildListener, getSessionListeners, getUrl, removeChildListener, removeStateListenerpublic JEtcdClient(URL url)
public void doCreatePersistent(String path)
public long doCreateEphemeral(String path)
public boolean checkExists(String path)
public JEtcdClient.EtcdWatcher createChildWatcherListener(String path, ChildListener listener)
public List<String> addChildWatcherListener(String path, JEtcdClient.EtcdWatcher etcdWatcher)
public void removeChildWatcherListener(String path, JEtcdClient.EtcdWatcher etcdWatcher)
public List<String> getChildren(String path)
EtcdClientpath - the path to be found direct children.public boolean isConnected()
EtcdClientpublic long createLease(long second)
EtcdClientsecond - lease time (support second only).public long createLease(long ttl,
long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
EtcdClientttl - lease time (support second only).timeout - the maximum time to waitunit - the time unit of the timeout argumentInterruptedException - if the current thread was interrupted
while waitingExecutionException - if this future completed exceptionallyTimeoutException - if the wait timed outpublic void delete(String path)
EtcdClientdelete 在接口中 EtcdClientdelete 在类中 AbstractEtcdClient<JEtcdClient.EtcdWatcher>path - the path to be removedpublic void revokeLease(long lease)
EtcdClientlease - to be removed leasepublic void doClose()
doClose 在类中 AbstractEtcdClient<JEtcdClient.EtcdWatcher>public String getKVValue(String key)
EtcdClientkey - the specified keypublic boolean put(String key, String value)
EtcdClientkey - the specified keyvalue - the paired valuepublic boolean putEphemeral(String key, String value)
EtcdClientkey - the specified keyvalue - the paired valuepublic io.grpc.ManagedChannel getChannel()
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.