接口 Client

  • 所有已知实现类:
    AbstractClient, ConnectionBasedClient, IpPortBasedClient

    public interface Client
    Nacos naming client.

    The abstract concept of the client stored by on the server of Nacos naming module. It is used to store which services the client has published and subscribed.

    作者:
    xiweng.yy
    • 方法详细资料

      • getClientId

        java.lang.String getClientId()
        Get the unique id of current client.
        返回:
        id of client
      • isEphemeral

        boolean isEphemeral()
        Whether is ephemeral of current client.
        返回:
        true if client is ephemeral, otherwise false
      • setLastUpdatedTime

        void setLastUpdatedTime()
        Set the last time for updating current client as current time.
      • getLastUpdatedTime

        long getLastUpdatedTime()
        Get the last time for updating current client.
        返回:
        last time for updating
      • addServiceInstance

        boolean addServiceInstance​(Service service,
                                   InstancePublishInfo instancePublishInfo)
        Add a new instance for service for current client.
        参数:
        service - publish service
        instancePublishInfo - instance
        返回:
        true if add successfully, otherwise false
      • removeServiceInstance

        InstancePublishInfo removeServiceInstance​(Service service)
        Remove service instance from client.
        参数:
        service - service of instance
        返回:
        instance info if exist, otherwise null
      • getInstancePublishInfo

        InstancePublishInfo getInstancePublishInfo​(Service service)
        Get instance info of service from client.
        参数:
        service - service of instance
        返回:
        instance info
      • getAllPublishedService

        java.util.Collection<Service> getAllPublishedService()
        Get all published service of current client.
        返回:
        published services
      • addServiceSubscriber

        boolean addServiceSubscriber​(Service service,
                                     Subscriber subscriber)
        Add a new subscriber for target service.
        参数:
        service - subscribe service
        subscriber - subscriber
        返回:
        true if add successfully, otherwise false
      • removeServiceSubscriber

        boolean removeServiceSubscriber​(Service service)
        Remove subscriber for service.
        参数:
        service - service of subscriber
        返回:
        true if remove successfully, otherwise false
      • getSubscriber

        Subscriber getSubscriber​(Service service)
        Get subscriber of service from client.
        参数:
        service - service of subscriber
        返回:
        subscriber
      • getAllSubscribeService

        java.util.Collection<Service> getAllSubscribeService()
        Get all subscribe service of current client.
        返回:
        subscribe services
      • generateSyncData

        ClientSyncData generateSyncData()
        Generate sync data.
        返回:
        sync data
      • isExpire

        boolean isExpire​(long currentTime)
        Whether current client is expired.
        参数:
        currentTime - unified current timestamp
        返回:
        true if client has expired, otherwise false
      • release

        void release()
        Release current client and release resources if neccessary.
      • recalculateRevision

        long recalculateRevision()
        Recalculate client revision and get its value.
        返回:
        recalculated revision value
      • getRevision

        long getRevision()
        Get client revision.
        返回:
        current revision without recalculation
      • setRevision

        void setRevision​(long revision)
        Set client revision.
        参数:
        revision - revision of this client to update