I have little problem using monitors: I followed the example of the ping
monitor but calling monitors.waitForMonitor(xxx) in a test case always throws
an IllegalMonitorStateException
java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at jsystem.framework.monitor.MonitorsManager.waitForMonitor(MonitorsManager.java:131)
What do I miss? As far as I see the threads are synchronized.
public void waitForMonitor(Monitor monitor, long timeout) throws Exception {
...
synchronized (monitor) {
t.wait(timeout);
}
...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-10-04
mhhh now I am wondering shouldn't be the thread synchronized?
public void waitForMonitor(Monitor monitor, long timeout) throws Exception {
...
synchronized (t) {
t.wait(timeout);
}
...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have little problem using monitors: I followed the example of the ping
monitor but calling monitors.waitForMonitor(xxx) in a test case always throws
an IllegalMonitorStateException
What do I miss? As far as I see the threads are synchronized.
mhhh now I am wondering shouldn't be the thread synchronized?
It looks as if you are right.
t should be synchronized since the wait() is performed on it.
did you try it?
Not yet. Will have a look on it later today. If it works with with t.wait() I
will open a ticket
Exception does not happen if t is synchronized. I've checked it with the
latest code from 5.6 branch