类 ServiceUtil


  • public final class ServiceUtil
    extends java.lang.Object
    Service util.
    作者:
    xiweng.yy
    • 构造器概要

      构造器 
      构造器 说明
      ServiceUtil()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      private static boolean checkCluster​(java.util.Set<java.lang.String> clusterSets, com.alibaba.nacos.api.naming.pojo.Instance instance)  
      private static boolean checkEnabled​(boolean enableOnly, com.alibaba.nacos.api.naming.pojo.Instance instance)  
      private static com.alibaba.nacos.api.naming.pojo.ServiceInfo doSelectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo, java.lang.String cluster, boolean healthyOnly, boolean enableOnly, ServiceUtil.InstancesFilter filter)
      Select instance of service info.
      static java.util.List<java.lang.String> pageServiceName​(int pageNo, int pageSize, java.util.Collection<java.lang.String> serviceNameSet)
      Page service name.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectEnabledInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo)
      Select healthy instance of service info.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectHealthyInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo)
      Select healthy instance of service info.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo, boolean healthyOnly, boolean enableOnly)
      Select instance of service info.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo, java.lang.String cluster)
      Select instance of service info.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo, java.lang.String cluster, boolean healthyOnly)
      Select instance of service info.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo, java.lang.String cluster, boolean healthyOnly, boolean enableOnly)
      Select instance of service info.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstancesWithHealthyProtection​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo, ServiceMetadata serviceMetadata, boolean healthyOnly, boolean enableOnly, Subscriber subscriber)
      Select instance of service info with healthy protection.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstancesWithHealthyProtection​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo, ServiceMetadata serviceMetadata, Subscriber subscriber)
      Select instance of service info with healthy protection.
      static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstancesWithHealthyProtection​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo, ServiceMetadata serviceMetadata, java.lang.String cluster, boolean healthyOnly, boolean enableOnly, java.lang.String subscriberIp)
      Select instance of service info with healthy protection.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • ServiceUtil

        public ServiceUtil()
    • 方法详细资料

      • pageServiceName

        public static java.util.List<java.lang.String> pageServiceName​(int pageNo,
                                                                       int pageSize,
                                                                       java.util.Collection<java.lang.String> serviceNameSet)
        Page service name.
        参数:
        pageNo - page number
        pageSize - size per page
        serviceNameSet - service name set
        返回:
        service name list by paged
      • selectHealthyInstances

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectHealthyInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo)
        Select healthy instance of service info.
        参数:
        serviceInfo - original service info
        返回:
        new service info
      • selectEnabledInstances

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectEnabledInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo)
        Select healthy instance of service info.
        参数:
        serviceInfo - original service info
        返回:
        new service info
      • selectInstances

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo,
                                                                                    java.lang.String cluster)
        Select instance of service info.
        参数:
        serviceInfo - original service info
        cluster - cluster of instances
        返回:
        new service info
      • selectInstances

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo,
                                                                                    boolean healthyOnly,
                                                                                    boolean enableOnly)
        Select instance of service info.
        参数:
        serviceInfo - original service info
        healthyOnly - whether only select instance which healthy
        enableOnly - whether only select instance which enabled
        返回:
        new service info
      • selectInstances

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo,
                                                                                    java.lang.String cluster,
                                                                                    boolean healthyOnly)
        Select instance of service info.
        参数:
        serviceInfo - original service info
        cluster - cluster of instances
        healthyOnly - whether only select instance which healthy
        返回:
        new service info
      • selectInstances

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo,
                                                                                    java.lang.String cluster,
                                                                                    boolean healthyOnly,
                                                                                    boolean enableOnly)
        Select instance of service info.
        参数:
        serviceInfo - original service info
        cluster - cluster of instances
        healthyOnly - whether only select instance which healthy
        enableOnly - whether only select instance which enabled
        返回:
        new service info
      • selectInstancesWithHealthyProtection

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstancesWithHealthyProtection​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo,
                                                                                                         ServiceMetadata serviceMetadata,
                                                                                                         Subscriber subscriber)
        Select instance of service info with healthy protection.
        参数:
        serviceInfo - original service info
        serviceMetadata - service meta info
        subscriber - subscriber
        返回:
        new service info
      • selectInstancesWithHealthyProtection

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstancesWithHealthyProtection​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo,
                                                                                                         ServiceMetadata serviceMetadata,
                                                                                                         boolean healthyOnly,
                                                                                                         boolean enableOnly,
                                                                                                         Subscriber subscriber)
        Select instance of service info with healthy protection.
        参数:
        serviceInfo - original service info
        serviceMetadata - service meta info
        healthyOnly - whether only select instance which healthy
        enableOnly - whether only select instance which enabled
        subscriber - subscriber
        返回:
        new service info
      • selectInstancesWithHealthyProtection

        public static com.alibaba.nacos.api.naming.pojo.ServiceInfo selectInstancesWithHealthyProtection​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo,
                                                                                                         ServiceMetadata serviceMetadata,
                                                                                                         java.lang.String cluster,
                                                                                                         boolean healthyOnly,
                                                                                                         boolean enableOnly,
                                                                                                         java.lang.String subscriberIp)
        Select instance of service info with healthy protection.
        参数:
        serviceInfo - original service info
        serviceMetadata - service meta info
        cluster - cluster of instances
        healthyOnly - whether only select instance which healthy
        enableOnly - whether only select instance which enabled
        subscriberIp - subscriber ip address
        返回:
        new service info
      • doSelectInstances

        private static com.alibaba.nacos.api.naming.pojo.ServiceInfo doSelectInstances​(com.alibaba.nacos.api.naming.pojo.ServiceInfo serviceInfo,
                                                                                       java.lang.String cluster,
                                                                                       boolean healthyOnly,
                                                                                       boolean enableOnly,
                                                                                       ServiceUtil.InstancesFilter filter)
        Select instance of service info.
        参数:
        serviceInfo - original service info
        cluster - cluster of instances
        healthyOnly - whether only select instance which healthy
        enableOnly - whether only select instance which enabled
        filter - do some other filter operation
        返回:
        new service info
      • checkCluster

        private static boolean checkCluster​(java.util.Set<java.lang.String> clusterSets,
                                            com.alibaba.nacos.api.naming.pojo.Instance instance)
      • checkEnabled

        private static boolean checkEnabled​(boolean enableOnly,
                                            com.alibaba.nacos.api.naming.pojo.Instance instance)