use of org.objectweb.proactive.core.ProActiveTimeoutException in project scheduling by ow2-proactive.
the class SchedulerMonitorsHandler method waitWithMonitor.
// ---------------------------------------------------------------//
// private methods
// these methods MUST NOT be called from a synchronized(this) block
// ---------------------------------------------------------------//
private void waitWithMonitor(EventMonitor monitor, long timeout) throws ProActiveTimeoutException {
TimeoutAccounter counter = TimeoutAccounter.getAccounter(timeout);
synchronized (monitor) {
monitor.setTimeouted(false);
while (!counter.isTimeoutElapsed()) {
if (monitor.eventOccured())
return;
try {
// System.out.println("I AM WAITING FOR EVENT : " + monitor.getWaitedEvent() + " during " +
// counter.getRemainingTimeout());
monitor.wait(counter.getRemainingTimeout());
} catch (InterruptedException e) {
// spurious wake-up, nothing to do
e.printStackTrace();
}
}
monitor.setTimeouted(true);
}
throw new ProActiveTimeoutException("timeout elapsed");
}
Aggregations