On Thu, 2006-04-06 at 02:37 -0700, Hakan Isikhan wrote:
> Hi Roland,
> Thanks for reply. below is the code partion from my
> app. i release connection in finally block. i use
> httpclient 3.0. please check my code and i would like
> to hear your ideas. thank you again for your interest.
> 

Hakan,

Can you tell us where exactly the thread blocks?

Oleg

>   // single httpclient instance from a
> MultiThreadedHttpConnectionManager
>   PostMethod post = new PostMethod(serverURL);
>   //post add parameters....
> 
>               try {
> 
>                       int statusCode = client.executeMethod(post);
> 
>                       if (statusCode != HttpStatus.SC_OK) {
>                               return null;
>                       }
> 
>                       // Read the response body.
>                       InputStream in = post.getResponseBodyAsStream();
>                       StringBuffer sb = new StringBuffer();
>                       char ch;
>                       int i;
>                       while ((i = in.read()) > -1) {
>                               sb.append((char) i);
>                       }
> 
>                   //process response
> 
>               } catch (Exception e) {
>                e.printStackTrace();
>               } finally {
>                       post.releaseConnection();
>               }
> 
> --- Roland Weber <[EMAIL PROTECTED]> wrote:
> 
> > Hello Hakan,
> > 
> > > if some thread gets connection timeout , let's say
> > > more than 5 times, thread just hangs. i donot use
> > any
> > > retry manager or something like that. my threads
> > do
> > > not reach run() method's exit block. i need to
> > > reinitiate stop all other threads and start again
> > > manually.
> > > 
> > > what could be the reason ?
> > 
> > You probably do not release the connection if you
> > get
> > a connection timeout. Make sure the call to release
> > the connection is in a finally{} block. Otherwise,
> > each connection timeout leaks a connection, and your
> > thread blocks when no more connections are
> > available.
> > 
> > hope that helps,
> >   Roland
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to