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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:40:35+00:00 2026-05-15T06:40:35+00:00

I want to implement a design in Java where I have multiple event sources

  • 0

I want to implement a design in Java where I have multiple event sources (Threads). Such event source accomplish a specific task and had to notify the unique Event Handler (Class) and this one have to accomplish other tasks according to event sources notifications.

My question is : how to implement this desiqn in the appropriate manner in Java?
There is a design pattern similar to this design?

Thank you in advance :).

  • 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-15T06:40:36+00:00Added an answer on May 15, 2026 at 6:40 am

    I think you are looking for the Observer pattern. Java does have some standard interfaces (java.util.Observer, java.util.Observable), though these are not type specific; so you might consider your own if the domain seems to require it.

    class MyThread implements Runnable {
     Observable observable;
    
     public MyThread(EventHandler observer) {
      observable = new Observable();
      observable.addObserver(observer);
     }
    
     public void run() {
      while (!done())  {
       Object result = doStuff();
       observable.notifyObservers(result);
      }
     }
    }
    
    // might have this be singleton
    class EventHandler implements Observer {
     public synchronized void update(Observable o, Object arg) {
      accomplishOtherTask();
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement singleten design pattern in iphone code I have one array.
I have basic knowledge of javascript and jquery . I want to implement design
This is what I want to accomplish for homework: Design and implement a program
i starter in jqgrid, i want implement inline edit in jqgrid i have this
I want to implement an aplication where I have various Objects that can be
Intro We have a project to design and implement this semester. For our project,
I am new to design patterns and now I want to implement the Strategy
I'm trying to implement a design I created in photoshop. I want to use
I want to implement a simple wiki. Most probably will be using Java on
I want to be able to design/implement a splash screen that originally goes over

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.