Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 969439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:38:26+00:00 2026-05-16T02:38:26+00:00

I have a procedure (procA) which needs to call a webservice many times and

  • 0

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    
    ...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:38:26+00:00Added an answer on May 16, 2026 at 2:38 am

    The easiest thing is to use a proper ExecutorService and just use the invokeAll method. Your jobs run asynchronously, and the calling method blocks until all are complete.

    Alternately you could have each instance of procA gather up a collection of the Future objects that go with the work it submitted to the executor. (Or do it in method scope if appropriate.) Then iterate over them and block on their get() methods. When the loop is done, the work is done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of search functions (stored procedures) which need to return results
I have a stored procedure which is building a dynamic sql query and then
I have stored procedure that insanely times out every single time it's called from
I have written code which should call MSSQL 2005 procedure from my servlet. The
I have stored procedure which executes another stored procedure several times. I need union
So if a language provides higher order procedure then I can have procedure that
i have a procedure in which i am inserting record in employee table.nad getting
I have a stored procedure, PROC , which receives some parameters. If one of
I have a procedure which accepts files . I have stored these files in
I have a custom PHP function which executes a stored procedure and returns an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.