Class ExceptionConvertingCallable<V,​E extends Exception>

  • Type Parameters:
    V - The type of result of the method to call.
    E - The type of the throwable to replace an occurred exception.
    All Implemented Interfaces:
    Callable<V>

    public class ExceptionConvertingCallable<V,​E extends Exception>
    extends Object
    implements Callable<V>
    This class provides the means to call a method and replace an occurred exception by a different one. This is useful if the occurred exception is transferred to a remote JVM that does not know the occurred exception or that should not need to know the exception.
    • Field Detail

      • logger

        protected final Logger logger
        The logger for logging the occurred exception.
    • Constructor Detail

      • ExceptionConvertingCallable

        public ExceptionConvertingCallable​(ThrowableCreatingCallable<V,​E> tcc,
                                           Logger logger)
        Creates a new callable executing a method and logging and replacing an occurred exception by a different one.
        Parameters:
        tcc - The callable providing the actual call as well as the means to replace an occurred exception.
        logger - The logger for logging the occurred exception.