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 7405371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:23:39+00:00 2026-05-29T05:23:39+00:00

I am using an unbounded, thread-caching Java-ExecutorService which concurrently processes my tasks. Now I

  • 0

I am using an unbounded, thread-caching Java-ExecutorService which concurrently processes my tasks.
Now I have some tasks that do just some lengthy operations (the minority) and some tasks that do blocking IO (connecting to an URL, the majority).
If running my application and starting one workload, about 70 tasks are dispatched to the executor which fires up 70 threads and processes all of them concurrently.

I want to limit the threads per host that the task wants to connect to and if possible, also the number of overall tasks. My problem is that all tasks do something like fork-join, so they spawn other tasks and wait for their result before proceeding. This means I can’t just use a semaphore or a bounded-queue per host, since a tasks could fork other tasks which won’t get processed until the semaphore/queue has a free slot, thus the application is deadlocked.

Is there some pattern to approach this problem?

Refined: IO(=network)-bound Tasks are submitted. After doing some IO-work they potentially fork other IO-Bound tasks, then join them and, potentially, do additional IO-bound processing.

This seems to be Fork/Join with IO-bound Tasks. How do I limit/throttle the execution of IO-performing tasks without deadlocking the thread that initially forked the tasks (deadlocked because its forked child-tasks won’t get processed due to limits/throttling) ?

Thanks a bunch

  • 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-29T05:23:40+00:00Added an answer on May 29, 2026 at 5:23 am

    Async is definitely the way to go, as they compose very nicely. While the programming model is painful in Java, using Finagle on top of Netty is a breeze with Scala, where all operations are basically a function that takes a Request and returns a Future[Response] that can be mapped (transformed) across.

    See also:

    • http://twitter.github.com/scala_school/finagle.html
    • https://github.com/twitter/finagle
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I am using a Datagridview (unbounded mode) and I have selected enable adding in
I'm having some issues using XmlSerializer and XmlTextReader in c# when saving DataTables which
I have this schema and i'm using JAXB to generate java stub files. <?xml
We are using JAXB to generate Java classes and have encountered a few cases
Hi I have following which is not generating class file for complextypes using bindigs.xml
I'm using c#2.0 and WinForms. I have a datagridview control, unbound, loading small amounts
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the

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.