Class ExceptionLoggingCallable<V>

java.lang.Object
de.aristaflow.adept2.util.threading.ExceptionLoggingCallable<V>
Type Parameters:
V - the result type of method call.
All Implemented Interfaces:
Callable<V>

public class ExceptionLoggingCallable<V> extends Object implements Callable<V>
A callable catching exceptions and virtual machine errors and optionally rethrowing them.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Callable<V>
    The wrapped callable.
    protected final Logger
    The logger with which to log an exception.
    protected final boolean
    Whether to rethrow an occurred exception or virtual machine error.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExceptionLoggingCallable(Callable<V> callable, boolean rethrow, Logger logger)
    Wraps the designated callable to catch and log exceptions and virtual machine errors to the designated logger and optionally rethrowing the exception/virtual machine error.
  • Method Summary

    Modifier and Type
    Method
    Description
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • callable

      protected final Callable<V> callable
      The wrapped callable.
    • rethrow

      protected final boolean rethrow
      Whether to rethrow an occurred exception or virtual machine error.
    • logger

      protected final Logger logger
      The logger with which to log an exception.
  • Constructor Details

    • ExceptionLoggingCallable

      public ExceptionLoggingCallable(Callable<V> callable, boolean rethrow, Logger logger)
      Wraps the designated callable to catch and log exceptions and virtual machine errors to the designated logger and optionally rethrowing the exception/virtual machine error. In case of a scheduled runnable, rethrowing will stop further executions.
      Parameters:
      callable - The wrapped callable.
      rethrow - Whether to rethrow an occurred exception or virtual machine error.
      logger - The logger with which to log an exception.
  • Method Details