List of usage examples for java.lang Long wait
public final native void wait(long timeoutMillis) throws InterruptedException;
From source file:org.alfresco.bm.event.DelayingSampleEventProcessor.java
@Override public EventResult processEvent(Event event) throws Exception { boolean fail = (Math.random() * 100) < failurePercent; long time = getValue(minTime, maxTime); Long mutex = new Long(0); synchronized (mutex) { mutex.wait(time); }// w w w .ja v a 2 s . com if (fail) { return new EventResult("Sample must fail " + failurePercent + "% of the time.", false); } else { Event outputEvent = new Event(outputEventName, null); return new EventResult("Sample must succeed " + (100 - failurePercent) + "% of the time.", outputEvent); } }