如何在CXF Cilent代码中设置属性MaxConnection



我正在开发CXF客户端。我从那里从WSDL生成存根,并从那里生成Develope代码。我的代码像那样

URL WSDL_LOCATION = new URL(targetURL);
CustomerWS_Service CustomerWSService = new CustomerWS_Service (WSDL_LOCATION);
CustomerWS customerWS = CustomerWSService.getCustomerWSPort();

现在,我想将一些属性设置为连接:

max_total_connection: maximum number of connections allowed
max_connection_per_host: maximum number of connections allowed for a given host config

一些研究告诉我将这些属性设置为Httpurlconnection。但是我不知道该怎么做或至少如何从代码中获得httpurlconnection obj。

您必须在总线级别设置此设置。总线属性可以像下面的类似一样配置。您不使用异步,因此不需要放置此属性。我也建议从JaxWsClientFactoryBean创建客户端 SpringBus bus = new SpringBus(); bus.setProperty(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE); bus.setProperty("org.apache.cxf.transport.http.async.SO_KEEPALIVE",Boolean.TRUE); bus.setProperty("org.apache.cxf.transport.http.async.SO_TIMEOUT",Boolean.FALSE); bus.setProperty("org.apache.cxf.transport.http.async.MAX_CONNECTIONS","totalConnections")); bus.setProperty("org.apache.cxf.transport.http.async.MAX_PER_HOST_CONNECTIONS","connectionsPerHost"));

相关内容

  • 没有找到相关文章

最新更新