I have a procedure (procA) which needs to call a webservice many times and then return the set of results.
procA may be called a handful of times concurrently.
the calls to the webservice take a set amount of time, however concurrent calls do not greatly impact the performance.
therefore it would be beneficial to create a thread pool for procA to make the calls to the webservice so that a single call to procA can que up all of it's calls to the webservice and then wait until they are all finished before continuing.
however i do not want to have a thread pool per procA because if there are multiple concurrent calls to procA, i want to limit/throttle the total number of threads accessing the webservice at once.
the optimum solution would be a shared thread pool which each call to procA shares.
the only problem i need help solving is how do i tell that all of the webservice tasks queued by the first call to procA are finished?
EDIT: stack trace
Daemon Thread [http-80-4] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: 158
FutureTask$Sync(AbstractQueuedSynchronizer).parkAndCheckInterrupt() line: 747
FutureTask$Sync(AbstractQueuedSynchronizer).doAcquireSharedInterruptibly(int) line: 905
FutureTask$Sync(AbstractQueuedSynchronizer).acquireSharedInterruptibly(int) line: 1217
FutureTask$Sync.innerGet() line: 218
FutureTask<V>.get() line: 83
ThreadPoolExecutor(AbstractExecutorService).invokeAll(Collection<Callable<T>>) line: 205
...