C
Christian
Hello Folks,
I just encountered one of those impossible Exceptions.. now I would like
to ask if someone has an explanetion how this could happen.
First the stacktrace (Only Top line Semaphore.acqire seems important to me):
java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at org.eclipse.core.internal.jobs.Semaphore.acquire(Semaphore.java:38)
at org.eclipse.core.internal.jobs.JobManager.join(JobManager.java:699)
at org.eclipse.core.internal.jobs.InternalJob.join(InternalJob.java:321)
at org.eclipse.core.runtime.jobs.Job.join(Job.java:384)
at
de.du_hub.uc.gui.transferview.TransfersView.update(TransfersView.java:288)
at java.util.Observable.notifyObservers(Unknown Source)
at uc.ConnectionHandler.notifyObservers(ConnectionHandler.java:350)
....
so and the code of that Semaphore implementation:
public synchronized boolean acquire(long delay) throws
InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
long start = System.currentTimeMillis();
long timeLeft = delay;
while (true) {
if (notifications > 0) {
notifications--;
return true;
}
if (timeLeft <= 0)
return false;
wait(timeLeft); //here is Line 38
timeLeft = start + delay - System.currentTimeMillis();
}
}
Someone got an Idea what can create such an Exception. Not that I would
know a way to reproduce it. Though I am curious.
I just encountered one of those impossible Exceptions.. now I would like
to ask if someone has an explanetion how this could happen.
First the stacktrace (Only Top line Semaphore.acqire seems important to me):
java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at org.eclipse.core.internal.jobs.Semaphore.acquire(Semaphore.java:38)
at org.eclipse.core.internal.jobs.JobManager.join(JobManager.java:699)
at org.eclipse.core.internal.jobs.InternalJob.join(InternalJob.java:321)
at org.eclipse.core.runtime.jobs.Job.join(Job.java:384)
at
de.du_hub.uc.gui.transferview.TransfersView.update(TransfersView.java:288)
at java.util.Observable.notifyObservers(Unknown Source)
at uc.ConnectionHandler.notifyObservers(ConnectionHandler.java:350)
....
so and the code of that Semaphore implementation:
public synchronized boolean acquire(long delay) throws
InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
long start = System.currentTimeMillis();
long timeLeft = delay;
while (true) {
if (notifications > 0) {
notifications--;
return true;
}
if (timeLeft <= 0)
return false;
wait(timeLeft); //here is Line 38
timeLeft = start + delay - System.currentTimeMillis();
}
}
Someone got an Idea what can create such an Exception. Not that I would
know a way to reproduce it. Though I am curious.