Is it possible to tell Axis to reuse a connection?
posted 10 years ago
I have a java program, written by someone else, that uses Axis generated stubs to invoke methods on a web service. The problem is that there is a large loop, and a method gets invoked with each iteration, creating a new connection each time. Is there a way to make subsequent iterations reuse the same connection?
Here is the general structure of the loop and the code it executes:
As you can see, the code tries to keep no more than 20 invocations going on at once. I know that since there's no synchronization it's possible for more than 20 calls to happen concurrently, but that's no big deal. The problem is, how to make sure that all the calls in the for loop reuse the same connection? I'm assuming that even if proxy.invoke() uses the same Port stub for every call, a new connection will still be created each time.
Could someone familiar with Axis offer any advice?