Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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?. Please help me.

share|improve this question
    
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? –  vikasTheJavaDeveloper 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.