public class JEtcdClientWrapper extends Object
| Modifier and Type | Field and Description |
|---|---|
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 |
| Constructor and Description |
|---|
JEtcdClientWrapper(URL url) |
| Modifier and Type | Method and Description |
|---|---|
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 exeception) |
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 happend or not.
|
public static final Charset UTF_8
public static final long DEFAULT_REQUEST_TIMEOUT
public static final int DEFAULT_INBOUND_SIZE
public static final String GRPC_MAX_INBOUND_SIZE_KEY
public static final String ETCD_REQUEST_TIMEOUT_KEY
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 exeception)
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.