0

I have two different project deployed in tomcat server. From one project I called the web services to call the second project.

Sometime I have to call the web services 200 times at once. So this is what I did:

while(rs.next())
{
    Thread t1 = new Thread(new ClassA(a,b);
    t1.start();
    try {
        t1.join();
    }
    catch (InterruptedException e) 
    {
        e.printStackTrace();
    }
}

And in this ClassA I called another method from different class which actually call the web service through HTTPClient. The web service takes some time as it perform many functions.

Problem is when I try this many times it give following exception:-

INFO: I/O exception (java.net.ConnectException) caught when processing request:     Connection timed out
Mar 14, 2013 9:04:47 AM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry

Am I doing something wrong here? Should I have to move the code which call the web service inside ClassA class?

sparkhee93
  • 1,381
  • 3
  • 21
  • 30
vikas27
  • 563
  • 5
  • 14
  • 36
  • Why do you join/wait for the thread ? – PeterMmm Mar 14 '13 at 10:05
  • I know this is more like a sequential flow, but it was already there, I just created a new web service. What can I do to prevent this error? – vikas27 Mar 14 '13 at 10:11
  • _The web service takes some time as it perform many functions_ could be too long. Did you try to set a longer timeout ? – PeterMmm Mar 14 '13 at 11:02

0 Answers0