Exception in thread “” java.lang.IllegalMonitorStateException


Simple fix, you seem to have missed putting your “notify” and “wait” in a synchronized (the relevant object) block. Now, you may ask what is the relevant object. If the wait is waiting to get information that will help this object (with is a thread) run, then you should synchronize on “this”. If you are waiting for a linked list to get some information, then you should synchronize on that linked list object.

Do it right!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s