In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the principle and application of ConfigFilterChainManager in nacos client". In daily operation, I believe that many people have doubts about the principle and application of ConfigFilterChainManager in nacos client. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "the principle and application of ConfigFilterChainManager in nacos client". Next, please follow the editor to study!
Order
This paper mainly studies the ConfigFilterChainManager of nacos client.
IConfigFilterChain
Nacos-1.1.3/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilterChain.java
Public interface IConfigFilterChain {/ * * Filter aciton * * @ param request request * @ param response response * @ throws NacosException NacosException * / void doFilter (IConfigRequest request, IConfigResponse response) throws NacosException;}
The IConfigFilterChain interface defines the doFilter method
ConfigFilterChainManager
Nacos-1.1.3/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigFilterChainManager.java
Public class ConfigFilterChainManager implements IConfigFilterChain {private List filters = Lists.newArrayList (); public synchronized ConfigFilterChainManager addFilter (IConfigFilter filter) {/ / insert int I = 0 in order of order size; while (I
< this.filters.size()) { IConfigFilter currentValue = this.filters.get(i); if (currentValue.getFilterName().equals(filter.getFilterName())) { break; } if (filter.getOrder() >= currentValue.getOrder () & & I < this.filters.size () {else {this.filters.add (I, filter); break;}} if (I = = this.filters.size ()) {this.filters.add (I, filter);} return this } @ Override public void doFilter (IConfigRequest request, IConfigResponse response) throws NacosException {new VirtualFilterChain (this.filters) .doFilter (request, response);} /.}
ConfigFilterChainManager implements the IConfigFilterChain interface, and its doFilter method uses filters to create the VirtualFilterChain, and then executes its doFilter method; it provides the addFilter method, which can be added to the filters according to the order order of the filter
VirtualFilterChain
Nacos-1.1.3/client/src/main/java/com/alibaba/nacos/client/config/filter/impl/ConfigFilterChainManager.java
Public class ConfigFilterChainManager implements IConfigFilterChain {/ /. Private static class VirtualFilterChain implements IConfigFilterChain {private final List
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.