On Mon, 2006-04-03 at 12:41 +0200, Mathias Peters wrote: > thanks, > > unfortunately I can't reuse the HttpClient. > though, >
Why is that? You should seriously reconsider the design of your application Oleg > now I di the following > > --snip-- > client.executeMethod(get); > ... > ... = get.getResponseBody(); > ... > get.releaseConnection(); > client.getHttpConnectionManager().getConnection(get.getHostConfiguration()).close(); > --snap-- > > it's a bit ugly, but I think it works... > > > > > Oleg Kalnichevski schrieb: > > On Mon, 2006-04-03 at 10:55 +0200, Roland Weber wrote: > > > >> Hello Mathias, > >> > >> > >>> After executing the GetMethod with the client I fetch the responseBody > >>> via getResponseBody() and then I call closeIdleConnections() with a > >>> timeout of 15s on the corresponding HttpConnectionManger. After that I > >>> call releaseConnection() on the GetMethod-Object. > >>> > >>> Question: Is the Connection that was used closed after that or does it > >>> remain open? > >>> > >> It remains open. > >> > >> > >>> If it remains open, how can I close it? > >>> > >> Several options: > >> 1. send a "Connection: close" header with the request > >> 2. call closeIdleConnections() *after* releasing the connection > >> and/or with a lower timeout > >> 3. implement a connection manager that always closes connections > >> > >> > > > > Mathias, > > > > The real question is whether this is what you really want or you just > > want to make sure your app does not run out of file descriptors. If > > latter is the case make sure > > (1) HttpClient instance gets reused along with its connection manager > > whenever possible > > (2) you periodically call HttpConnectionManager#closeIdleConnections() > > to drop connections that have been idle for too long > > > > Oleg > > > > > > > > > >> hope that helps, > >> Roland > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
