On Tue, 2005-03-22 at 10:30 -0800, Thunder Parley wrote:
> Hi List,
> 
> I use SimpleHttpConnectionManager to connect to a http
> server and make repeated POST and GET queries. Using
> the single connection. Problem I have is after a while
> (~60-80 queries) server only returns errors. If I
> pause the process for 10 minutes, still the same
> issue. If I kill the JVM for a minute, then restart,
> it works ok. I suspect this is due to the server
> rejecting or limiting the number of queries over a
> single connection/session. Is there anything analogous
> to shutdown for SimpleHttpConnectionManager so that I
> can have a new clean connection/session with out
> restarting the JVM?

Consider implementing a custom connection manager that drops the
connection if it has been open longer than a specified period of time.
It may be sufficient to extend SimpleHttpConnectionManager and override
the releaseConnection method.

Hope this helps,

Oleg



> 
> Sample code of current use:
> 
> SimpleHttpConnectionManager simp = new
> SimpleHttpConnectionManager();
> HttpClient http = new HttpClient(simp);
> while (true) {
>    URL url = new URL(site);
>    PostMethod postmeth = new PostMethod(site);
>    postmeth.addParameter("param1", "foobilicious1");
>    HttpConnectionManagerParams manp = new
> HttpConnectionManagerParams();
>    manp.setDefaultMaxConnectionsPerHost(1);
>    manp.setMaxTotalConnections(1);
>    simp.setParams(manp);
>    http.executeMethod(postmeth);
>    //do something with POST results
>    postmeth.releaseConnection();
>    GetMethod getmeth = new GetMethod(site2);
>    http.executeMethod(getmeth);
>    //do something with GET results
>    // checking GET for error
>    getmeth.releaseConnection();
>    while (foundError) {
>       Thread.sleep(fiveMinutes);
>       http.executeMethod(getmeth);
>       // check response if we still get same error
>       // I seem to never escape this
>    }
>    // process non error GET response
> }
> 
> Thanks for any help or pointers!
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Sports - Sign up for Fantasy Baseball. 
> http://baseball.fantasysports.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