类 SelectorManager
- java.lang.Object
-
- com.alibaba.nacos.naming.selector.SelectorManager
-
@Component public class SelectorManager extends java.lang.ObjectSelectorManagerwork on initSelector.parse(Object), executeSelector.select(Object)and maintain the type ofSelectorandSelectorContextBuilder. It will provide theSelectortypes for web and openapi user to select.- 作者:
- chenglu
-
-
字段概要
字段 修饰符和类型 字段 说明 private java.util.Map<java.lang.String,com.alibaba.nacos.api.selector.context.SelectorContextBuilder>contextBuildersThe relationship of context type andSelectorContextBuilder.private java.util.Map<java.lang.String,java.lang.Class<? extends com.alibaba.nacos.api.selector.Selector>>selectorTypesThe relationship of selector type andSelectorclass.
-
构造器概要
构造器 构造器 说明 SelectorManager()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 java.util.List<java.lang.String>getAllSelectorTypes()return all selector type provided byselectorTypes.voidinit()init theSelectorclass andSelectorContextBuilder.private voidinitSelectorContextBuilders()init SelectorContextBuilders.private voidinitSelectorTypes()init SelectorTypes.com.alibaba.nacos.api.selector.SelectorparseSelector(java.lang.String type, java.lang.String condition)parseSelectorby 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 theSelector.select(Object). it will helpSelectorto build the context it need.
-
-
-
字段详细资料
-
contextBuilders
private java.util.Map<java.lang.String,com.alibaba.nacos.api.selector.context.SelectorContextBuilder> contextBuilders
The relationship of context type andSelectorContextBuilder.
-
selectorTypes
private java.util.Map<java.lang.String,java.lang.Class<? extends com.alibaba.nacos.api.selector.Selector>> selectorTypes
The relationship of selector type andSelectorclass.
-
-
方法详细资料
-
init
@PostConstruct public void init()
init theSelectorclass andSelectorContextBuilder.
-
initSelectorContextBuilders
private void initSelectorContextBuilders()
init SelectorContextBuilders.
-
initSelectorTypes
private void initSelectorTypes()
init SelectorTypes. The subclass ofSelectormust have public access default constructor.
-
getAllSelectorTypes
public java.util.List<java.lang.String> getAllSelectorTypes()
return all selector type provided byselectorTypes.- 返回:
- 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.NacosExceptionparseSelectorby 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 forSelector.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 theSelector.select(Object). it will helpSelectorto build the context it need.- 参数:
selector-Selector.consumerIp- the consumer Ip address.providers- the provider list for select.- 返回:
- the select instance list.
-
-