Class Runnables

java.lang.Object
org.apache.pulsar.common.util.Runnables

public final class Runnables extends Object
  • Method Details

    • catchingAndLoggingThrowables

      public static Runnable catchingAndLoggingThrowables(Runnable runnable)
      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 in ScheduledExecutorService.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