public final void waitForTerminatedEvent(Time timeout) throws InterruptedException {
while(!rendezvous.terminatedEventReceived()) {
Event e = enterEventHandling(timeout);
if (e == null) throw new SchedulerException(terminatedEventName + " expected instead of timeout after " + timeout);
try {
// if (e instanceof SchedulerCloseEvent) logger.info(e + " ignored");
// else
if (!rendezvous.terminatedEventReceived()) {
SchedulerException x = new SchedulerException(terminatedEventName + " expected instead of " + e);
throwableMailbox.setIfFirst(x);
}
}
finally {
leaveEventHandling();