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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:52:15+00:00 2026-05-27T11:52:15+00:00

This might be controversial, but I just realized I very seldom use wait and

  • 0

This might be controversial, but I just realized I very seldom use wait and notify directly. Instead, I use some higher-level construct from the java.util.concurrent package. Are there use cases where wait and notify are the only solution or should they only be used when building higher-level constructs?

  • 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-27T11:52:16+00:00Added an answer on May 27, 2026 at 11:52 am

    Are there use cases where wait and notify are the only solution or should they only be used when building higher-level constructs?

    They should only be used when building higher-level constructs. If you have a case where the existing higher-level constructs don’t solve your problem, you don’t want to revert to wait/notify; you want to design a higher-level construct that solves your problem. You may implement it with wait/notify.

    For example, I once had a problem that required concurrent execution of a collection of tasks with hierarchical dependencies, where the dependency conditions involved a combination of conjunction (“and”) and disjunction (“or”). I.e., there were cases where one task’s condition was “Task A is done and Task B is done,” cases where it was “Task A is done or Task B is done,” and various combinations of these (e.g., “Task A is done, and either Task B or Task C is done”).

    So I wrote a small utility library that provided an interface for clients to submit collections of tasks annotated with their conditions, submitted these tasks to an Executor as soon as their preconditions were met, and monitored task completion to kick off newly eligible tasks. Some of that was implemented using java.util.concurrent (mainly Executor and Semaphore), but other parts involved using wait/notify (the “coordinator” thread is notified of task completion with wait/notify).

    So the code ended up much easier to understand and troubleshoot, and later we found other uses for the same task coordinator library.

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

Sidebar

Related Questions

This might sound very dumb question but I am just confused. I am quite
I know this might seem a controversial question but it really is not meant
This might be a very simple thing for you gurus, but I'm not familiar
This might seem obvious but I've had this error when trying to use LINQ
This might be a very basic question, but I'm getting a bit confused. I'm
This might be very simple for you Gurus but I'm stumped on this. I
This might be a very dumb question but, is there a way to fire
This might be a silly question but it just popped up in my mind.
this might be a very global question but here we go: I was wondering
This might be a very simple question but after much searching on different forums

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.