Hello everyone,
I am using HttpClient version 3.0.1 in my project. I am creating several
threads and each thread is responsible for uploading data to some websites. I
have defined my HttpClient object as:
MultiThreadedHttpConnectionManager connectionManager = new
MultiThreadedHttpConnectionManager();
client = new HttpClient(connectionManager);
and I am passing the "client" object to my threads as:
Thread[] awa = new Thread[_iNumThreads];
for (int i = 0; i < awa.length; i++) {
Connotea oConnotea = new Connotea("connotea_"+i,_iNumThreads,
_oUpdateMan,_lConsistencyInterval,ctc,_sData, client);
awa[i] = new Thread(oConnotea);
}
//start threads here
for(int y=0;y<awa.length;y++){
awa[y].start();
}
I have run my above code with 1 thread and 10 thread total separately..I
thought that I will not get this exception with one thread but I am still
getting it.I might be using something wrong and I really appreciate your time
and any help...And the exception as:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
at
org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)
at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at cgl.citationmanagement.Connotea.postDEToConnotea(Connotea.java:142)
at cgl.citationmanagement.Connotea.uploadUpdates(Connotea.java:193)
at cgl.citationmanagement.Connotea.propagateUpdates(Connotea.java:320)
at cgl.citationmanagement.Connotea.run(Connotea.java:1034)
at java.lang.Thread.run(Thread.java:595)
I tried to follow HttpClient Threading guideline but I might use something
wrong in my implementation..I really appreciate any help. Thank you so much for
your time and response..
--fatih
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ