Hi Fabian, Thank you very much for code, I will try it in my application.
regs 2016-10-14 10:18 GMT+02:00 Fabian Finke <[email protected]>: > Hi Claudio, > of course I can do. See the snippet below. After calling oc.execute(), I > call my own method 'freeServiceClient(ServiceClient sc)' from a finally > block. > In this method I retrieve the last used operation context, get the > InputStream and close it. > > OperationContext oc = sc.getLastOperationContext(); > > Object transportInObj = oc.getProperty(MessageContext.TRANSPORT_IN); > > //in case of the InputStream is not consumed we have to close it. Otherwise > the underlying connection in the > // PoolingHttpClientConnectionManager will not be released anymore. > if (transportInObj != null && transportInObj instanceof InputStream) { > InputStream transport = (InputStream) transportInObj; > try { > transport.close(); > } catch (IOException e) { > fct.logError(Messages.PWC_SP_08_02, e, e.getMessage()); > } > } > > > You can add debug output afterwards to control the stats of the > PoolingHttpClientConnectionManager: > > > if (debug) { > ConfigurationContext configurationContext = oc.getConfigurationContext(); > Object connectionManagerObj = > configurationContext.getProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER); > > PoolingHttpClientConnectionManager manager; > > if (connectionManagerObj instanceof PoolingHttpClientConnectionManager) { > manager = (PoolingHttpClientConnectionManager) connectionManagerObj; > fct.logDebug(Messages.PWC_DBG_01, "Total stats of > PoolingHttpClientConnectionManager:"); > fct.logDebug(Messages.PWC_DBG_01, manager.getTotalStats().toString()); > } > } > > Hope this helps. > > Regards > Fabian > > > 2016-10-14 9:18 GMT+02:00 Claudio Degioanni <[email protected]>: > >> Hi Fabian, >> >> Thank you for response. >> >> I haven't so much experience with message context. >> >> Can you send me a snippet code of example how to close the input stream ? >> >> regs >> >> 2016-10-13 17:33 GMT+02:00 Fabian Finke <[email protected]>: >> >>> Hi Claudio, >>> We had a similar problem. Unless the InputStream of the HttpResponse >>> entity is not closed, the connection will not be released. You can >>> workaround your problem by closing the InputStream when freeing the service >>> client. To do so retrieve the MessageContext.TRANSPORT_IN property from the >>> operation context and close it. >>> >>> Regards >>> Fabian >>> >>> Am 3. Oktober 2016 11:32:30 MESZ, schrieb Claudio Degioanni < >>> [email protected]>: >>> >>>> Hi All, >>>> >>>> I have some problems with Axis library 1.7.3 configurated to use >>>> HttpClient 4.4.1, after 200 request the library throw a TimeoutException >>>> from connection pool: >>>> >>>> Caused by: org.apache.axis2.AxisFault: Timeout waiting for connection >>>> from pool >>>> at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) >>>> ~[axis2-kernel-1.7.3.jar:1.7.3] >>>> at org.apache.axis2.transport.http.impl.httpclient4.HTTPSenderI >>>> mpl.sendViaPost(HTTPSenderImpl.java:242) ~[axis2-transport-http-1.7.3.j >>>> ar:1.7.3] >>>> at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:121) >>>> ~[axis2-transport-http-1.7.3.jar:1.7.3] >>>> at org.apache.axis2.transport.http.CommonsHTTPTransportSender.w >>>> riteMessageWithCommons(CommonsHTTPTransportSender.java:403) >>>> ~[axis2-transport-http-1.7.3.jar:1.7.3] >>>> at org.apache.axis2.transport.http.CommonsHTTPTransportSender.i >>>> nvoke(CommonsHTTPTransportSender.java:234) >>>> ~[axis2-transport-http-1.7.3.jar:1.7.3] >>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431) >>>> ~[axis2-kernel-1.7.3.jar:1.7.3] >>>> at >>>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399) >>>> ~[axis2-kernel-1.7.3.jar:1.7.3] >>>> at org.apache.axis2.description.OutInAxisOperationClient.execut >>>> eImpl(OutInAxisOperation.java:225) ~[axis2-kernel-1.7.3.jar:1.7.3] >>>> at >>>> org.apache.axis2.client.OperationClient.execute(OperationClient.java:150) >>>> ~[axis2-kernel-1.7.3.jar:1.7.3] >>>> .... >>>> Caused by: org.apache.http.conn.ConnectionPoolTimeoutException: >>>> Timeout waiting for connection from pool >>>> at org.apache.http.impl.conn.PoolingClientConnectionManager.lea >>>> seConnection(PoolingClientConnectionManager.java:226) >>>> ~[httpclient-4.4.1.jar:4.4.1] >>>> at org.apache.http.impl.conn.PoolingClientConnectionManager$1.g >>>> etConnection(PoolingClientConnectionManager.java:195) >>>> ~[httpclient-4.4.1.jar:4.4.1] >>>> at org.apache.http.impl.client.DefaultRequestDirector.execute(D >>>> efaultRequestDirector.java:423) ~[httpclient-4.4.1.jar:4.4.1] >>>> at >>>> org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882) >>>> ~[httpclient-4.4.1.jar:4.4.1] >>>> at >>>> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) >>>> ~[httpclient-4.4.1.jar:4.4.1] >>>> at >>>> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) >>>> ~[httpclient-4.4.1.jar:4.4.1] >>>> at org.apache.axis2.transport.http.impl.httpclient4.HTTPSenderI >>>> mpl.executeMethod(HTTPSenderImpl.java:873) >>>> ~[axis2-transport-http-1.7.3.jar:1.7.3] >>>> at org.apache.axis2.transport.http.impl.httpclient4.HTTPSenderI >>>> mpl.sendViaPost(HTTPSenderImpl.java:238) ~[axis2-transport-http-1.7.3.j >>>> ar:1.7.3] >>>> ... 15 common frames omitted >>>> >>>> I think che connection pool used by library don't work correctly, stuck >>>> the connections to 200 ??? >>>> >>>> I need to use HttpClient 4.X to better support windows proxy >>>> authentication I can't downgrade to http common 3.X >>>> >>>> Any suggestions ? >>>> >>>> regs >>>> >>>> -- >>>> >>>> Degioanni Ing. Claudio >>>> >>>> >>>> ------------------------------ >>>> >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >> >> >> -- >> >> Degioanni Ing. Claudio >> >> ------------------------------------------------------------ >> ------------------------------------------------------------ >> ----------------------------------- >> Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi >> allegati è vietato e potrebbe costituire reato. >> Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se >> provvedesse alla distruzione dello stesso >> e degli eventuali allegati. >> Opinioni, conclusioni o altre informazioni riportate nella e-mail, che >> non siano relative alle attività e/o >> alla missione aziendale. si intendono non attribuibili alla società >> stessa, né la impegnano in alcun modo. >> > > -- Degioanni Ing. Claudio ----------------------------------------------------------------------------------------------------------------------------------------------------------- Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi allegati è vietato e potrebbe costituire reato. Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se provvedesse alla distruzione dello stesso e degli eventuali allegati. Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non siano relative alle attività e/o alla missione aziendale. si intendono non attribuibili alla società stessa, né la impegnano in alcun modo.
