I would like to know how to handle exceptions from my Callable when I use Void as a return type.
Something like this:
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
call a third party code where an exception is thrown...
return null;
}
});
Since I don't need any result from this callable I don't call get() on the Future returned from calling executor.submit(). Thus the exception is swallowed.
What is the right way to handle such exceptions?