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

  • Home
  • SEARCH
  • 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 8324033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:54:38+00:00 2026-06-08T23:54:38+00:00

I am not a java expert, and my question is somewhat abstract, i need

  • 0

I am not a java expert, and my question is somewhat abstract, i need an advice on how is a best to implement my suggested architecture and requirements.

I will describe my requirements:

I have a manager object that receives tasks to process (holds a a task queue), the manager should distribute tasks between dedicated threads. each thread knows to execute only specific type of tasks.

I created a Main Manager class with a collection of type specific threads,
When a Main manager receives a new task it will push a task to the queue of a thread class object that knows how to handle this task (each thread has it’s own task queue).

A thread need to pool a task from his queue when he finished to handle previous task, but if the queue is empty , he should not use resources and need to be awaken when a new task arrives.

My though (may be not so good) was to use threads that extend timer object and with a timed task of checking its queue, but this does not fit to my requirement to free resources until a new task arrives.

Any suggestion of the best way to handle those system requirement will be appreciated (My Question is not a homework but rather a part of my developing tasks).

EDIT

(An answer to @Alexander Torstling) I am using currently a Blocking Queue as a tasks queue, my question is not a concurrency issue but rather an architectural , i want to free resources when the queue is empty and i want to be awaken maybe by event if a new task arrives, if i have finished handling with a task and i have more of them i will continue to handle next task;

  • 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-06-08T23:54:39+00:00Added an answer on June 8, 2026 at 11:54 pm

    Have a look at BlockingQueue. And in order to avoid creating too many threads, you might want to consider using an Executor, which can manage a thread pool for you.

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

Sidebar

Related Questions

I'm not familiar with Java but I need to make a request to a
I am not an expert in Java; I am hoping that someone on this
I'm not a network expert so please bear with me. I need to establish
I'm not a CS guru nor a Java expert, so please forgive me if
I'm not an expert of JSTL and expression language, so my question may be
That's an HTML templater, not a php templater, not java or whatever. I am
Why does Java not have a file copy method? This seems like such an
Why are some exceptions in Java not caught by catch (Exception ex) ? This
I have a legacy Java (not my native language) app that I'm trying to
Possible Duplicate: Developing for Android in Eclipse: R.java not generating what to do if

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.