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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:37:59+00:00 2026-05-23T11:37:59+00:00

In a GUI, I have a few buttons. These buttons spin off worker threads

  • 0

In a GUI, I have a few buttons. These buttons spin off worker threads that send requests over the network to a server. In a seperate thread, there is a listener that receives the responses from the server. This response is passed to the same object that the worker threads are executing methods on via the Observer/Observable interface.

What I need to do is to have the worker threads wait for a response from the server that pertains to them. Essentially a worker thread should send the command, then wait for some condition that indicates the right response was received. I can think of multiple ways to do this (sleeping, polling, wait, notify, monitors, etc), but is there a particular method that would be best in this situation?

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

    I would recommend to use a high level “locking” mechanism from the java.util.concurrent package
    Eg a CountDownLatch — “A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes. “

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

Sidebar

Related Questions

I have a GUI that is issuing commands to a web server based on
I am creating a simple GUI in C++ which have few buttons in it.
I have done a few months of development with Qt (built GUI programmatically only)
I have a GUI that is going to do a lot of disparate tasks.
I have a GUI C++ application (Visual Studio 2008) that needs to be converted
I have a GUI tool that manages state sequences. One component is a class
I have just made my first proper little desktop GUI application that basically wraps
I have been studying swing for developing gui applications since a few days. The
Say I got something like this.. bool isPatched; I have a few other GUI's
I have a few complex GUI elements (like a custom calendar with many days

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.