类 JEtcdClientWrapper
- java.lang.Object
-
- org.apache.dubbo.remoting.etcd.jetcd.JEtcdClientWrapper
-
public class JEtcdClientWrapper extends Object
-
-
字段概要
字段 修饰符和类型 字段 说明 static intDEFAULT_INBOUND_SIZEstatic longDEFAULT_REQUEST_TIMEOUTdefault request timeoutstatic StringETCD_REQUEST_TIMEOUT_KEYstatic StringGRPC_MAX_INBOUND_SIZE_KEYstatic CharsetUTF_8
-
构造器概要
构造器 构造器 说明 JEtcdClientWrapper(URL url)
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 booleancheckExists(String path)try to check if path exists.longcreateEphemeral(String path)create new ephemeral path save to etcd .longcreateLease(long second)longcreateLease(long ttl, long timeout, TimeUnit unit)voidcreatePersistent(String path)voiddelete(String path)String[]endPoints(String backupAddress)io.grpc.ManagedChannelgetChannel()try to get current connected channel.List<String>getChildren(String path)find direct children directory, excluding path self, Never return null.io.etcd.jetcd.ClientgetClient()ConnectionStateListenergetConnectionStateListener()StringgetKVValue(String key)booleanisConnected()voidkeepAlive(long lease)booleanput(String key, String value)booleanputEphemeral(String key, String value)static voidrequiredNotNull(Object obj, RuntimeException exception)voidrevokeLease(long lease)voidsetConnectionStateListener(ConnectionStateListener connectionStateListener)voidstart()because jetcd's connection change callback not supported yet, we must loop to test if connect or disconnect event happened or not.
-
-
-
构造器详细资料
-
JEtcdClientWrapper
public JEtcdClientWrapper(URL url)
-
-
方法详细资料
-
getClient
public io.etcd.jetcd.Client getClient()
-
getChannel
public io.grpc.ManagedChannel getChannel()
try to get current connected channel.- 返回:
- connected channel.
-
getChildren
public List<String> getChildren(String path)
find direct children directory, excluding path self, Never return null.- 参数:
path- the path to be found direct children.- 返回:
- direct children directory, contains zero element list if children directory not exists.
-
isConnected
public boolean isConnected()
-
createLease
public long createLease(long second)
-
revokeLease
public void revokeLease(long lease)
-
createLease
public long createLease(long ttl, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
-
checkExists
public boolean checkExists(String path)
try to check if path exists.
-
createPersistent
public void createPersistent(String path)
-
createEphemeral
public long createEphemeral(String path)
create new ephemeral path save to etcd . if node disconnect from etcd, it will be deleted automatically by etcd when session timeout.- 参数:
path- the path to be saved- 返回:
- the lease of current path.
-
keepAlive
public void keepAlive(long lease)
-
delete
public void delete(String path)
-
start
public void start()
because jetcd's connection change callback not supported yet, we must loop to test if connect or disconnect event happened or not. It will be changed in the future if we found better choice.
-
getConnectionStateListener
public ConnectionStateListener getConnectionStateListener()
-
setConnectionStateListener
public void setConnectionStateListener(ConnectionStateListener connectionStateListener)
-
requiredNotNull
public static void requiredNotNull(Object obj, RuntimeException exception)
-
-