类 JEtcdClientWrapper


  • public class JEtcdClientWrapper
    extends Object
    • 字段详细资料

      • UTF_8

        public static final Charset UTF_8
      • DEFAULT_REQUEST_TIMEOUT

        public static final long DEFAULT_REQUEST_TIMEOUT
        default request timeout
      • DEFAULT_INBOUND_SIZE

        public static final int DEFAULT_INBOUND_SIZE
        另请参阅:
        常量字段值
      • GRPC_MAX_INBOUND_SIZE_KEY

        public static final String GRPC_MAX_INBOUND_SIZE_KEY
        另请参阅:
        常量字段值
      • ETCD_REQUEST_TIMEOUT_KEY

        public static final String ETCD_REQUEST_TIMEOUT_KEY
        另请参阅:
        常量字段值
    • 构造器详细资料

      • 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)
      • 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)
      • endPoints

        public String[] endPoints​(String backupAddress)
      • 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.
      • setConnectionStateListener

        public void setConnectionStateListener​(ConnectionStateListener connectionStateListener)
      • putEphemeral

        public boolean putEphemeral​(String key,
                                    String value)