Name

IllegalMonitorStateException

Synopsis

This is an exception that signals one of the following conditions:

  • A thread has called the Object wait() method on a object for which it does not hold the monitor.

  • A thread has called the Object notify() or notifyAll() method on a object for which it does not hold the monitor.

The monitor for an object obj is acquired either by synchronizing on that object using the synchronized (obj) expression, or by entering a non-static method of that object’s class that is declared using the synchronized keyword.

This class is the same as its J2SE equivalent, apart from its inability to be serialized.

                  Subclasses
public class IllegalMonitorStateException extends RuntimeException {  
// Public Constructors
   public IllegalMonitorStateException();  
   public IllegalMonitorStateException( String s);  
}

Get J2ME in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.