Search in sources :

Example 11 with ProActiveTimeoutException

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");
}
Also used : ProActiveTimeoutException(org.objectweb.proactive.core.ProActiveTimeoutException) TimeoutAccounter(org.objectweb.proactive.utils.TimeoutAccounter)

Aggregations

ProActiveTimeoutException (org.objectweb.proactive.core.ProActiveTimeoutException)11 Test (org.junit.Test)6 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)4 NodeSet (org.ow2.proactive.utils.NodeSet)4 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)3 TimeoutAccounter (org.objectweb.proactive.utils.TimeoutAccounter)3 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)3 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)3 File (java.io.File)2 DefaultInfrastructureManager (org.ow2.proactive.resourcemanager.nodesource.infrastructure.DefaultInfrastructureManager)2 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)2 JobId (org.ow2.proactive.scheduler.common.job.JobId)2 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)2 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)2 TestNode (functionaltests.utils.TestNode)1 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 UnknownHostException (java.net.UnknownHostException)1 ProActiveRuntimeException (org.objectweb.proactive.core.ProActiveRuntimeException)1