All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.enodeframework.common.io.Task Maven / Gradle / Ivy

There is a newer version: 1.1.10
Show newest version
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);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy