org.vfdtech.wrappers.VCompletableFuture Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utilities-and-generic-tools Show documentation
Show all versions of utilities-and-generic-tools Show documentation
A utilities service with generic tools implementation. Can be
plugged into your java project
package org.vfdtech.wrappers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.CompletableFuture;
public class VCompletableFuture extends CompletableFuture {
private static final Logger log = LoggerFactory.getLogger(VCompletableFuture.class);
public static void asyncRun(Runnable runnable) {
runAsync(runnable).handle((msg, ex) -> {
if (ex != null) {
log.error("== ERROR OCCURRED: ", ex);
}
return null;
});
}
public static CompletableFuture asyncSupply(Runnable runnable) {
return supplyAsync(() -> runnable).handle((msg, ex) -> {
if (ex != null) {
log.error("== ERROR OCCURRED: ", ex);
}
return null;
});
}
}