org.enodeframework.common.io.Task Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of enode Show documentation
Show all versions of enode Show documentation
The enodeframework core implementation.
package org.enodeframework.common.io;
import org.enodeframework.common.exception.EnodeInterruptException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
/**
* @author [email protected]
*/
public class Task {
public static CompletableFuture completedTask = CompletableFuture.completedFuture(null);
public static void await(CountDownLatch latch) {
try {
latch.await();
} catch (InterruptedException e) {
throw new EnodeInterruptException(e);
}
}
public static T await(CompletableFuture future) {
return future.join();
}
public static void sleep(long sleepMilliseconds) {
try {
Thread.sleep(sleepMilliseconds);
} catch (InterruptedException e) {
throw new EnodeInterruptException(e);
}
}
}