A DESCRIPTION OF THE PROBLEM :
There is an example given at the bottom of AWTThreadIssues.html that indicates how to keep the JVM running after the application has made all components undisplayable, by creating a daemon thread and waiting on a private monitor.
The call to wait() on the lock object is not inside a block that synchronizes on the object. Therefore the current thread does not have a lock on the specified monitor and a java.lang.IllegalMonitorStateException is thrown.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<...>
Runnable r = new Runnable() {
public void run() {
Object o = new Object();
try {
synchronized(o) {
o.wait();
}
} catch (InterruptedException ie) {
}
}
};
Thread t = new Thread(r);
t.setDaemon(false);
t.start();
<...>
ACTUAL -
<...>
Runnable r = new Runnable() {
public void run() {
Object o = new Object();
try {
o.wait();
} catch (InterruptedException ie) {
}
}
};
Thread t = new Thread(r);
t.setDaemon(false);
t.start();
<...>
URL OF FAULTY DOCUMENTATION :
<jdk-root>/docs/api/java/awt/doc-files/AWTThreadIssues.html
###@###.### 2005-07-13 23:43:21 GMT
There is an example given at the bottom of AWTThreadIssues.html that indicates how to keep the JVM running after the application has made all components undisplayable, by creating a daemon thread and waiting on a private monitor.
The call to wait() on the lock object is not inside a block that synchronizes on the object. Therefore the current thread does not have a lock on the specified monitor and a java.lang.IllegalMonitorStateException is thrown.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<...>
Runnable r = new Runnable() {
public void run() {
Object o = new Object();
try {
synchronized(o) {
o.wait();
}
} catch (InterruptedException ie) {
}
}
};
Thread t = new Thread(r);
t.setDaemon(false);
t.start();
<...>
ACTUAL -
<...>
Runnable r = new Runnable() {
public void run() {
Object o = new Object();
try {
o.wait();
} catch (InterruptedException ie) {
}
}
};
Thread t = new Thread(r);
t.setDaemon(false);
t.start();
<...>
URL OF FAULTY DOCUMENTATION :
<jdk-root>/docs/api/java/awt/doc-files/AWTThreadIssues.html
###@###.### 2005-07-13 23:43:21 GMT