Package org.apache.pulsar.common.util
Class Runnables
java.lang.Object
org.apache.pulsar.common.util.Runnables
-
Method Summary
Modifier and TypeMethodDescriptionstatic Runnable
catchingAndLoggingThrowables
(Runnable runnable) Wraps a Runnable so that throwables are caught and logged when a Runnable is run.
-
Method Details
-
catchingAndLoggingThrowables
Wraps a Runnable so that throwables are caught and logged when a Runnable is run. The main usecase for this method is to be used inScheduledExecutorService.scheduleAtFixedRate(Runnable, long, long, TimeUnit)
calls to ensure that the scheduled task doesn't get cancelled as a result of an uncaught exception.- Parameters:
runnable
- The runnable to wrap- Returns:
- a wrapped Runnable
-