Package org.apache.bookkeeper.util
Class SafeRunnable
java.lang.Object
org.apache.bookkeeper.util.SafeRunnable
- All Implemented Interfaces:
Runnable,SafeRunnable
A SafeRunnable implementation.
-
Field Summary
Fields inherited from interface org.apache.bookkeeper.common.util.SafeRunnable
LOGGER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SafeRunnableUtility method to use SafeRunnable from lambdas.static SafeRunnableUtility method to use SafeRunnable from lambdas with a custom exception handler.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.bookkeeper.common.util.SafeRunnable
run, safeRun
-
Constructor Details
-
SafeRunnable
public SafeRunnable()
-
-
Method Details
-
safeRun
Utility method to use SafeRunnable from lambdas.Eg:
executor.submit(SafeRunnable.safeRun(() -> { // My not-safe code }); -
safeRun
Utility method to use SafeRunnable from lambdas with a custom exception handler.Eg:
executor.submit(SafeRunnable.safeRun(() -> { // My not-safe code }, exception -> { // Handle exception );- Parameters:
runnable-exceptionHandler- handler that will be called when there are any exception- Returns:
-