Thread notify

I have a producer/consumer scenario with one producer and multiple consumer.

When the producer adds a message to the queue it notifies the consumer waiting for messages.

If there are no consumer waiting for messages, is the notify ignored?

Will calling notify() when no consumers are waiting cause problem.

I don't know how to really check it, but as long as I am running the program, its not causing any problem. I beleive that if there are no consumers waiting, then the notify() is simply ignored. Am i right?

[544 byte] By [lupansanseia] at [2007-11-26 20:50:46]
# 1
> Will calling notify() when no consumers are waiting> cause problem.No.Although you almost always want notifyAll, not notify. Notify will only wake up one thread--and you don't get to know which one. NotifyAll makes all waiting threads eligible to run.
jverda at 2007-7-10 2:15:26 > top of Java-index,Java Essentials,Java Programming...
# 2
Thank you.
lupansanseia at 2007-7-10 2:15:26 > top of Java-index,Java Essentials,Java Programming...