Hi Yuffie I just went through the link which explains that why windows need to establish loopback connection for selector. It looks like you use camel camel-netty4-http to build a proxy to route the message for you.
Now back to camel-netty4-http, there is a producer pool which cache the Channel object for about 300 seconds and 100 max idle per camel-netty4-http endpoint. If you don’t want keep the connection open for a while, you may think to set *producerPoolEnabled* option to be false, then camel-netty4-http will don’t pool the connection for you. If you want to try to turn the producer pool yourself, please check this[1] and search ProducerPool for more information. [1]https://camel.apache.org/netty4 -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On April 15, 2015 at 9:51:53 AM, Yuffie (yuffie.pa...@gmail.com) wrote: > Hi,Willem. > this is my RouteBuilder: > --------------------------------------------------------------- > public class MobileRouteBuilder extends RouteBuilder implements > PropertyConstants { > > private String port; > > public void setPort(String port) { > this.port = port; > } > > private Tracer tracer = new Tracer(); > > /** > * 设置tracer的开关 > * > * @param exchange > * tracer > * @return String > * > */ > public void setTracing(Exchange exchange) { > Message in = exchange.getIn(); > String enabletracer = (String) in.getHeader("tracer"); > if (enabletracer.equalsIgnoreCase("true")) { > tracer.setEnabled(true); > in.setBody("tracer on"); > } else { > tracer.setEnabled(false); > in.setBody("tracer off"); > } > } > > @Override > public void configure() throws Exception { > > // 通过手动新建tracer并设置setEnabled(false),能够在路由中加入一个不启用的tracer > tracer.setEnabled(false); > getContext().addInterceptStrategy(tracer); > > Set keyset = > IntegrationServiceUtil.integrationServiceMap.keySet(); > Map routeMap = new HashMap(); > String value = null; > StringBuffer strbuf = new StringBuffer(); > for (String k : keyset) { > value = IntegrationServiceUtil.integrationServiceMap.get(k); > if (value != null) { > URL url = new URL(value); > if (url.getPort()<0) { > strbuf.append("netty4-http:") > > .append(url.getProtocol()).append("://").append(url.getHost()).append(":80").append(url.getFile()) > > .append("?" + > "bridgeEndpoint=true&throwExceptionOnFailure=false"); > } else { > strbuf.append("netty4-http:").append(value) > .append("?" + > "bridgeEndpoint=true&throwExceptionOnFailure=false"); > } > routeMap.put(k, strbuf.toString()); > } > value = null; > strbuf = new StringBuffer(); > } > > from("netty4-http:http://0.0.0.0:" + port + "/rest?" + > "bridgeEndpoint=true&matchOnUriPrefix=true") > .process(new LogProcessor()) > .process(new UTF8ToGBKProcessor()) > .process(new AdapterProcessor()) > .process(new IfAddUccodeProcess()) > .choice() > .when(header("serviceNickName").isNull()) > .to(routeMap.get("business")) > .when(header("serviceNickName").isEqualTo(PRODUCTNICK)) > .to(routeMap.get("i6p")) > .when(header("serviceNickName").isEqualTo(WORKFLOWNICK)) > .to(routeMap.get("workflow")) > .when(header("serviceNickName").isEqualTo(BUSINESSNICK)) > .to(routeMap.get("business")) > .when(header("serviceNickName").isEqualTo(NETCALLNICK)) > .to(routeMap.get("netcallservice")) > .when(header("serviceNickName").isEqualTo(AUTHNICK)) > .to(routeMap.get("EnterpriseInfoService")) > .when(header("serviceNickName").isEqualTo(UPDATENICK)) > .to(routeMap.get("NetCallUpdateService")) > > .when(header("serviceNickName").isEqualTo("LoopbackDetection")) > .bean(new LoopbackDetectionEndpoint()) > .when(header("serviceNickName").isEqualTo("SetTracing")) > .beanRef("mobileRouteBuilder", "setTracing") > .endChoice() > > .end(); > > from("servlet:///?matchOnUriPrefix=true&bridgeEndpoint=true") > .process(new ServletAdapterProcessor()) > .choice() > .when(header("serviceNickName").isEqualTo(AUTHNICK)) > .process(new SplitProcessor()) > .choice() > > .when(header("EnterpriseInfoServiceRoute").isEqualTo("getauthusers")) > .to(routeMap.get("EnterpriseInfoService")) > .bean(new GetNCInfoEndpoint()) > > .when(header("EnterpriseInfoServiceRoute").isEqualTo("authdevices")) > .process(new IfCanAuthProcessor()) > .choice() > .when(header("CanAuth").isEqualTo("true")) > > .to(routeMap.get("EnterpriseInfoService")) > .endChoice() > > .when(header("EnterpriseInfoServiceRoute").isEqualTo("other")) > .to(routeMap.get("EnterpriseInfoService")) > .endChoice() > .when(header("serviceNickName").isEqualTo(PRODUCTNICK)) > .to(routeMap.get("i6p")) > .when(header("serviceNickName").isEqualTo("properties")) > .bean(new PropertyEndpoint()) > .endChoice() > .end(); > } > } > > --------------------------------------------------- > > And this is deployed in the Tomcat. > > And we find that it maybe an issue of netty: > http://blog.csdn.net/haoel/article/details/2224055 > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Why-so-many-port-used-when-I-use-camel-netty4-http-tp5765433p5765797.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >