You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by kunal ashar <ka...@yahoo.co.uk> on 2005/11/07 14:01:58 UTC

Question on features of HTTPClient 2.0

Hi,

 

One of the HTTPClinet 2.0 Features says that

 

Connection management support for use in multi-threaded applications. Supports setting the maximum total connections as well as the maximum connections per host. Detects and closes stale connections. 

 

This says that it detects and closes the stale connections. 


My questions is 

 

"Is closing of idle connections are automatically taken care or we need to implement IdleConnectionTimeoutThread to close the idle connections forcefully?"

 

Thanks
Ashar


 

		
---------------------------------
How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos. Get Yahoo! Photos

Re: Question on features of HTTPClient 2.0

Posted by kunal ashar <ka...@yahoo.co.uk>.
Thank you all for your response!
 
Regards
Ashar

Ortwin Glück <od...@odi.ch> wrote:
Oleg Kalnichevski wrote:
> The connection will eventually get closed by the GC if it is no
> longer referenced. However, the process of garbage collection is
> often non deterministic, so lots of idle connections can pile up
> before they get GCed

I consider this abuse of the GC. GC is for memory management. It does a 
poor job as a general resource manager as finalize makes no guarantees 
about the time when it will be invoked (if ever).


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


		
---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.

Re: Question on features of HTTPClient 2.0

Posted by Ortwin Glück <od...@odi.ch>.
Oleg Kalnichevski wrote:
> The connection will eventually get closed by the GC if it is no
> longer referenced. However, the process of garbage collection is
> often non deterministic, so lots of idle connections can pile up
> before they get GCed

I consider this abuse of the GC. GC is for memory management. It does a 
poor job as a general resource manager as finalize makes no guarantees 
about the time when it will be invoked (if ever).


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: Question on features of HTTPClient 2.0

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, Nov 07, 2005 at 02:41:37PM +0000, kunal ashar wrote:
> Thanks for the reply.
>  
> When the connection will be come idle?.

When it is not being used.

>  
> Why do we need to forcefully run the separate thread to close the idle connections like CLOSE_WAIT?  

Because there's no way to query the state of a socket in Java (I know
of)

OS will close these connections after some particular amount of time if we don't run this thread?
>  

The connection will eventually get closed by the GC if it is no longer
referenced. However, the process of garbage collection is often non
deterministic, so lots of idle connections can pile up before they get
GCed

Oleg

> Thanks
> Ashar
>  
>  
> 
> 
> Oleg Kalnichevski <ol...@apache.org> wrote:
> On Mon, Nov 07, 2005 at 01:01:58PM +0000, kunal ashar wrote:
> > 
> > Hi,
> > 
> > 
> > 
> > One of the HTTPClinet 2.0 Features says that
> > 
> > 
> > 
> > Connection management support for use in multi-threaded applications. Supports setting the maximum total connections as well as the maximum connections per host. Detects and closes stale connections. 
> > 
> > 
> > 
> > This says that it detects and closes the stale connections. 
> > 
> > 
> > My questions is 
> > 
> > 
> > 
> > "Is closing of idle connections are automatically taken care or we need to implement IdleConnectionTimeoutThread to close the idle connections forcefully?"
> > 
> > 
> 
> Idle and stale connections are different things. Stale connections are
> automatically taken care of per default, whereas idle ones are not.
> Please note as well that IdleConnectionTimeoutThread is available in
> HttpClient 3.0 only. 
> 
> Hope this helps,
> 
> Oleg
> 
> 
> > 
> > Thanks
> > Ashar
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------
> > How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos. Get Yahoo! Photos
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 
> 
> 		
> ---------------------------------
> To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: Question on features of HTTPClient 2.0

Posted by Ortwin Glück <od...@odi.ch>.
Check out include/net/tcp.h in the Linux kernel tree. It (implicitly) 
defines the timeout for connections in CLOSE_WAIT. Depending on that 
time you may not want to wait as long. Sorry, I can not tell you what 
the actual timeout value is.

Odi

kunal ashar wrote:
> Thanks for the reply.
> 
> When the connection will be come idle?.
> 
> Why do we need to forcefully run the separate thread to close the
> idle connections like CLOSE_WAIT?  OS will close these connections
> after some particular amount of time if we don't run this thread?
> 
> Thanks Ashar


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: Question on features of HTTPClient 2.0

Posted by kunal ashar <ka...@yahoo.co.uk>.
Thanks for the reply.
 
When the connection will be come idle?.
 
Why do we need to forcefully run the separate thread to close the idle connections like CLOSE_WAIT?  OS will close these connections after some particular amount of time if we don't run this thread?
 
Thanks
Ashar
 
 


Oleg Kalnichevski <ol...@apache.org> wrote:
On Mon, Nov 07, 2005 at 01:01:58PM +0000, kunal ashar wrote:
> 
> Hi,
> 
> 
> 
> One of the HTTPClinet 2.0 Features says that
> 
> 
> 
> Connection management support for use in multi-threaded applications. Supports setting the maximum total connections as well as the maximum connections per host. Detects and closes stale connections. 
> 
> 
> 
> This says that it detects and closes the stale connections. 
> 
> 
> My questions is 
> 
> 
> 
> "Is closing of idle connections are automatically taken care or we need to implement IdleConnectionTimeoutThread to close the idle connections forcefully?"
> 
> 

Idle and stale connections are different things. Stale connections are
automatically taken care of per default, whereas idle ones are not.
Please note as well that IdleConnectionTimeoutThread is available in
HttpClient 3.0 only. 

Hope this helps,

Oleg


> 
> Thanks
> Ashar
> 
> 
> 
> 
> 
> ---------------------------------
> How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos. Get Yahoo! Photos

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


		
---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.

Re: Question on features of HTTPClient 2.0

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, Nov 07, 2005 at 01:01:58PM +0000, kunal ashar wrote:
> 
> Hi,
> 
>  
> 
> One of the HTTPClinet 2.0 Features says that
> 
>  
> 
> Connection management support for use in multi-threaded applications. Supports setting the maximum total connections as well as the maximum connections per host. Detects and closes stale connections. 
> 
>  
> 
> This says that it detects and closes the stale connections. 
> 
> 
> My questions is 
> 
>  
> 
> "Is closing of idle connections are automatically taken care or we need to implement IdleConnectionTimeoutThread to close the idle connections forcefully?"
> 
> 

Idle and stale connections are different things. Stale connections are
automatically taken care of per default, whereas idle ones are not.
Please note as well that IdleConnectionTimeoutThread is available in
HttpClient 3.0 only. 

Hope this helps,

Oleg


> 
> Thanks
> Ashar
> 
> 
>  
> 
> 		
> ---------------------------------
> How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos. Get Yahoo! Photos

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: Question on features of HTTPClient 2.0

Posted by Roland Weber <RO...@de.ibm.com>.
Hi Ashar,

> "Is closing of idle connections are automatically taken care or we 
> need to implement IdleConnectionTimeoutThread to close the idle 
> connections forcefully?"

If you use the MultiThreadedConnectionManager, it is taken care of.
If you use the SimpleConnectionManager, there is only one connection 
anyway.
Either way, there is no need to fuss with IdleConnectionTimeoutThread.

hope that helps,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org