Comment on Tutorial - wait(), notify() and notifyAll() in Java - A tutorial By Jagan



Comment Added by : Pranay

Comment Added at : 2012-09-19 19:08:45

Comment on Tutorial : wait(), notify() and notifyAll() in Java - A tutorial By Jagan
Hi,
Even if the while loops (in Producer and Consumer's run method ) in 27's code is made limited to a certain cycle then also 27's code could result into a thread (any one of producer or consumer) waiting indefinitely or for a long time.
This would happen as notify() is not present before returns from put() and get() methods. So there are chances when one of the thread could lead to a forever waiting state.


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. hello,
i have to connect the crystal report

View Tutorial          By: shanmugaraj at 2010-03-03 04:08:30

2. You just save ma arse, had a SQLite database, and
View Tutorial          By: codeRealm at 2011-11-13 12:58:05

3. thanx it i very helpful 4 me as i m new with java
View Tutorial          By: akminder at 2011-08-09 05:09:19

4. very nice example i really like it
View Tutorial          By: radha at 2012-03-15 17:50:52

5. Hi Friends,

I got a very interestin

View Tutorial          By: Rohit Kapur at 2011-07-27 20:56:57

6. Thanks!! This example was very helpful for me...
View Tutorial          By: Jonathas at 2010-03-11 07:47:51

7. All true, but the 2FA that has been implemented fo
View Tutorial          By: Joe Bloggs at 2013-04-22 13:40:24

8. Thanks, I understand the add function better now (
View Tutorial          By: Venus at 2011-02-11 09:09:55

9. How do you remove an element from the map?
View Tutorial          By: Shreejit at 2012-01-29 16:53:27

10. @Prab, no its 7 since it starts the counting at 0
View Tutorial          By: Shadowfaux at 2009-11-21 15:22:49