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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:50:36+00:00 2026-05-26T16:50:36+00:00

Considering the fact that wait() can only be called in a synchronized context which

  • 0

Considering the fact that wait() can only be called in a synchronized context which subsequently release the monitor until a notify/nofityAll has been called on the same object by another thread,

Assume Thread A is blocking on a wait() which results in Thread B acquiring the lock. Now if we interrupt Thread A, would control be transferred immediately to Thread A ? in which case, since the try catch block handling the InterrupException is within the synchronized context, and since only one Thread can hold the monitor at a time, what will happen to Thread B ? should it move to a blocked state until Thread A has finished execution ?

Thanks 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-26T16:50:37+00:00Added an answer on May 26, 2026 at 4:50 pm

    Reading the documentation does in fact help:

    http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Object.html#wait%28long%29

    Thus, when the thread is interrupted, it has to re-acquire the Object’s monitor to restore the synchronisation state before the exception is thrown. The same holds for returning from the wait(long) call after the specified amount of time has elapsed.

    The thread T is then removed from the wait set for this object and
    re-enabled for thread scheduling. It then competes in the usual manner
    with other threads for the right to synchronize on the object; once it
    has gained control of the object, all its synchronization claims on
    the object are restored to the status quo ante – that is, to the
    situation as of the time that the wait method was invoked. Thread T
    then returns from the invocation of the wait method. Thus, on return
    from the wait method, the synchronization state of the object and of
    thread T is exactly as it was when the wait method was invoked.

    If the current thread is interrupted by another thread while it is
    waiting, then an InterruptedException is thrown. This exception is not
    thrown until the lock status of this object has been restored as
    described above.

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

Sidebar

Related Questions

I'm considering storing some date values as ints. i.e 201003150900 Excepting the fact that
Considering this code, can I be absolutely sure that the finally block always executes,
Considering the fact that openmp uses simd model i.e. each instruction is executed by
Considering the fact that .net is a massive collection of classes, structs, interfaces, methods
Using Jess as the rule engine, we can assert a fact that some witness
Considering the criteria listed below, which of Python, Groovy or Ruby would you use?
As a subset of the question detach-subdirectory already made before and considering the fact
I've got a table structure that can be summarized as follows: pagegroup * pagegroupid
This afternoon, upon noticing a broken build and the fact that some files looked
I'm wondering about writing an application in Java which can synchronize files across my

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.