Wednesday, May 5, 2010

IllegalMonitorStateException

Base on JavaDoc, IllegalMonitorStateException is thrown to indicate that a thread has attempted to wait on an object's monitor or to notify other threads waiting on an object's monitor without owning the specified monitor.

This can happens when you perform notify, notifyAll, wait method for an object, especially, when you are trying to perform cross thread notify and wait operation.

The way to solve this issue is to surround the object to be notified or wait with synchornized block


synchronized (obj) {
obj.wait();
}

No comments:

Post a Comment

Oracle - Reclaim disk space

Oracle does not release disk space even if you had delete the data or tablespace. If you have enterprise manager, you should use it to  rec...