Hi,
My current code using httpclient looks something like this:
public class MyClass {
public void myMethod(String name,String value) {
/*This Method is called repeatedly*/
Thread t = new MyPostThread(name,value);
t.start();
}
public static MyPostThread extends Thread {
String name;
String value;
public MyPostThread(String name,String value) {
this.name=name;
this.value=value;
}
public void run() {
HttpClient client = new HttpClient();
PostMethod postMethod = new PostMethod(sameURL);
/*Set parameters in post method*/
client.executeMethod();
/*Do something with the response*/
postMethod.releaseConnection();
}
}
I am a little confused as to how the connection management takes place.
Should i be using the same HttpClient object across different threads?
Should I be in that case using the MultiThreadedConnectionManager?
Any brickkbats, suggestions,comments would be helpful.
--
Puneet
http://sahyog.blogspot.com/