public class JEtcdClientWrapper extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_INBOUND_SIZE |
static long |
DEFAULT_REQUEST_TIMEOUT
default request timeout
|
static String |
ETCD_REQUEST_TIMEOUT_KEY |
static String |
GRPC_MAX_INBOUND_SIZE_KEY |
static Charset |
UTF_8 |
| 构造器和说明 |
|---|
JEtcdClientWrapper(URL url) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
checkExists(String path)
try to check if path exists.
|
long |
createEphemeral(String path)
create new ephemeral path save to etcd .
|
long |
createLease(long second) |
long |
createLease(long ttl,
long timeout,
TimeUnit unit) |
void |
createPersistent(String path) |
void |
delete(String path) |
String[] |
endPoints(String backupAddress) |
io.grpc.ManagedChannel |
getChannel()
try to get current connected channel.
|
List<String> |
getChildren(String path)
find direct children directory, excluding path self,
Never return null.
|
io.etcd.jetcd.Client |
getClient() |
ConnectionStateListener |
getConnectionStateListener() |
String |
getKVValue(String key) |
boolean |
isConnected() |
void |
keepAlive(long lease) |
boolean |
put(String key,
String value) |
boolean |
putEphemeral(String key,
String value) |
static void |
requiredNotNull(Object obj,
RuntimeException exception) |
void |
revokeLease(long lease) |
void |
setConnectionStateListener(ConnectionStateListener connectionStateListener) |
void |
start()
because jetcd's connection change callback not supported yet, we must
loop to test if connect or disconnect event happened or not.
|
public static final Charset UTF_8
public static final long DEFAULT_REQUEST_TIMEOUT
public static final int DEFAULT_INBOUND_SIZE
public JEtcdClientWrapper(URL url)
public io.etcd.jetcd.Client getClient()
public io.grpc.ManagedChannel getChannel()
public List<String> getChildren(String path)
path - the path to be found direct children.public boolean isConnected()
public long createLease(long second)
public void revokeLease(long lease)
public long createLease(long ttl,
long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
public boolean checkExists(String path)
public void createPersistent(String path)
public long createEphemeral(String path)
path - the path to be savedpublic void keepAlive(long lease)
public void delete(String path)
public void start()
public ConnectionStateListener getConnectionStateListener()
public void setConnectionStateListener(ConnectionStateListener connectionStateListener)
public static void requiredNotNull(Object obj, RuntimeException exception)
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.