What does it mean when a IllegalStateException is thrown when entering a synchronized block? I'm seeing this sometimes inside the run-method of a thread:
public void run() {
while (true) {
int n = 0;
synchronized (service) { // IllegalStateException
n = processPendingRequests();
}
/*
* If n > 0, we processed at least one element, in which case we
* immediately check the queue again until it was empty.
*/
if (n == 0) {
sleep();
continue;
}
}
}
Can the service
object cause the IllegalStateException
? How?