Why wait notify and notifyAll called from synchronized block or method in Java
  Why wait notify and notifyAll called from synchronized block or method in Java
2D Graphics
3D Graphics
Web Design & Development
Business Applications
Business Development
Databases
Desktop Programming
Operating Systems
Video Editing
Miscellaneous
Newsletter
User Login
  • Username
  • Password
Stats
  • Tutorials: 39,021
  • Categories: 572

Java Tutorials : Why wait notify and notifyAll called from synchronized block or method in Java

Most of Java developer knows that wait() ,notify() and notifyAll() method of object class must have to be called inside synchronized method or synchronized block in Java but how many times we thought why ? Recently this questions was asked to in Java interview to one of my friend, he pondered for a moment and replied that if we don't call wait () or notify () method from synchronized context we will receive IllegalMonitorStateException in java. He was right in terms of behavior of language but as per him interviewer was not completely satisfied with the answer and wanted to explain more about it. After the interview he discussed the same questions with me and I thought he might have told about race condition between wait () and notify () in Java that could exists if we don't call them inside synchronized method or block. Let’s see how it could happen: Why wait notify and notifyAll called from synchronized block or method in Java  tutorial
    View Tutorial

Detailed Information

     Tutorial: Why wait notify and notifyAll called from synchronized block or method in Java
     Date Listed: 2011-08-18
     Submitted By: javabuddy
     Total Hits: 951
     Rating Tutorial Rating 2.56Tutorial Rating 2.56Tutorial Rating 2.56Tutorial Rating 2.56Tutorial Rating 2.56 (27 votes)

    Discuss Tutorial
    Comment On Tutorial
    View Tutorial
    Report Broken Link

 





© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap