Class ExceptionConvertingCallable<V,E extends Exception>
- java.lang.Object
-
- de.aristaflow.adept2.util.threading.ExceptionConvertingCallable<V,E>
-
- 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.
-
-
Constructor Summary
Constructors Constructor Description 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.
-
-
-
Field Detail
-
tcc
protected final ThrowableCreatingCallable<V,E extends Exception> tcc
The callable providing the actual call as well as the means to replace an occurred exception.
-
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.
-
-