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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:51:26+00:00 2026-05-15T04:51:26+00:00

When I call: setChanged(); notifyObservers(); on a java.until.Observable class, will all the listening Observer

  • 0

When I call:

setChanged();
notifyObservers();

on a java.until.Observable class, will all the listening Observer objects complete execution of their udpate() methods – assuming we are running in the same Thread – before the java.until.Observable class continues running?

This is important because I will be sending a few messages through the notifyObservers(Object o) method in quick concession, it is important that each Observer class has finished its method before the new one though.

I understand that the order of execution for each Observer class may vary when we call notifyObservers() – it is just important that the order of method execution for each individual instance is in order.

  • 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-15T04:51:27+00:00Added an answer on May 15, 2026 at 4:51 am

    java.util.Observable makes many claims on what implementers are expected to do. However as an interface, none of this is enforced.

    The contract for notifyObservers(Object o) is:

    If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.
    Each observer has its update method called with two arguments: this observable object and the arg argument.

    There is not an expectation of this method being synchronized. This means that if you are calling notifyObservers(Object o) in different threads it should not be expected to be synchronized.

    More important to your question, there is also not a corresponding expectation of java.util.Observer.update(Observable a, Object arg) finishing in a single thread. This means that you might call notifyObservers(Object o) all you like in a single thread, but Observer.update(Observable a, Object arg) might be spawning threads. If that is the case you cannot guarantee when the work it started will finish.

    If you are writing both the Observers and the Observables and you are not spawning threads, you can be sure that each call to notifyObservers(Object o) will finish only after the last call to update(Observable o, Object arg) finishes.

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

Sidebar

Related Questions

call.java: public class Call extends Activity{ boolean timerhasstarted; Intent callIntent; public void onCreate(Bundle savedInstanceState)
I just started playing with Observable , Observer and it's update() method and I
Call like: mAsyncRunner.request(me, params,new AsyncFacebookRunner.RequestListener() returns me all info for user /according to permisions/.
Call to a possibly undefined method test through a reference with static type Class.
I call a dll from Java using JNI. The DLL calls another thirdparty library
Can call a method by class name in same package without create object of
system call, exception, divided by 0, etc they all have the same vector entry
I call function from this code : <div id=header-button-news class=header-button-info> <a href=javascript:; title=Новости onclick=showNews()></a>
Call to undefined method after upgrading to PHP 5.4.0 mentions a few APC bug-reports
AJAX Call $.ajax({ url: '/api/Inventory', cache: false, type: 'POST', data: json, contentType: 'application/json, charset=utf-8',

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.