/** * Executes a specified task. If an exception occurs it will be wrapped in a RuntimeException * @param runnable * the task to be executed * @return * the result of the task execution */ public static void runUnchecked(Runnable runnable) { //NOSONAR runProtected(runnable).mapException(Exception.class, UncheckedException::new).get(); }
/** * Executes a specified task, regardless if it throws a checked or unchecked exception. * If an exception occurs it will be caught and wrapped in the execution result. * @param call * the task to be executed * @param <T> * the type of the return value * @return * the result of the task execution */ public static <T> T runUnchecked(Callable<T> call) { return runProtected(call).mapException(Exception.class, UncheckedException::new).get(); }