类 SelectorManager


  • @Component
    public class SelectorManager
    extends java.lang.Object
    SelectorManager work on init Selector.parse(Object), execute Selector.select(Object) and maintain the type of Selector and SelectorContextBuilder. It will provide the Selector types for web and openapi user to select.
    作者:
    chenglu
    • 字段概要

      字段 
      修饰符和类型 字段 说明
      private java.util.Map<java.lang.String,​com.alibaba.nacos.api.selector.context.SelectorContextBuilder> contextBuilders
      The relationship of context type and SelectorContextBuilder.
      private java.util.Map<java.lang.String,​java.lang.Class<? extends com.alibaba.nacos.api.selector.Selector>> selectorTypes
      The relationship of selector type and Selector class.
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      java.util.List<java.lang.String> getAllSelectorTypes()
      return all selector type provided by selectorTypes.
      void init()
      init the Selector class and SelectorContextBuilder.
      private void initSelectorContextBuilders()
      init SelectorContextBuilders.
      private void initSelectorTypes()
      init SelectorTypes.
      com.alibaba.nacos.api.selector.Selector parseSelector​(java.lang.String type, java.lang.String condition)
      parse Selector by selector type and condition. if not find the Selector type or parse failed, then will return null.
      <T extends com.alibaba.nacos.api.naming.pojo.Instance>
      java.util.List<T>
      select​(com.alibaba.nacos.api.selector.Selector selector, java.lang.String consumerIp, java.util.List<T> providers)
      invoke the Selector.select(Object). it will help Selector to build the context it need.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • contextBuilders

        private java.util.Map<java.lang.String,​com.alibaba.nacos.api.selector.context.SelectorContextBuilder> contextBuilders
        The relationship of context type and SelectorContextBuilder.
      • selectorTypes

        private java.util.Map<java.lang.String,​java.lang.Class<? extends com.alibaba.nacos.api.selector.Selector>> selectorTypes
        The relationship of selector type and Selector class.
    • 构造器详细资料

      • SelectorManager

        public SelectorManager()
    • 方法详细资料

      • init

        @PostConstruct
        public void init()
        init the Selector class and SelectorContextBuilder.
      • initSelectorContextBuilders

        private void initSelectorContextBuilders()
        init SelectorContextBuilders.
      • initSelectorTypes

        private void initSelectorTypes()
        init SelectorTypes. The subclass of Selector must have public access default constructor.
      • getAllSelectorTypes

        public java.util.List<java.lang.String> getAllSelectorTypes()
        return all selector type provided by selectorTypes.
        返回:
        select types.
      • parseSelector

        public com.alibaba.nacos.api.selector.Selector parseSelector​(java.lang.String type,
                                                                     java.lang.String condition)
                                                              throws com.alibaba.nacos.api.exception.NacosException
        parse Selector by selector type and condition. if not find the Selector type or parse failed, then will return null.
        参数:
        type - selector type. Selector.getType().
        condition - the condition provide for Selector.parse(Object).
        返回:
        Selector.
        抛出:
        com.alibaba.nacos.api.exception.NacosException
      • select

        public <T extends com.alibaba.nacos.api.naming.pojo.Instance> java.util.List<T> select​(com.alibaba.nacos.api.selector.Selector selector,
                                                                                               java.lang.String consumerIp,
                                                                                               java.util.List<T> providers)
        invoke the Selector.select(Object). it will help Selector to build the context it need.
        参数:
        selector - Selector.
        consumerIp - the consumer Ip address.
        providers - the provider list for select.
        返回:
        the select instance list.