If you have a class that implements Callable, but you don't plan on using the Future that is returned after you call Executor.submit(), you may lose any exceptions that are thrown. They literally disappear into the void. No log whatsoever.
So it is good practice to treat it a bit like you would with a Runnable and wrap the code in your call method with a try/catch to print the exception or log it somewhere.
Tuesday, October 07, 2008
Callable and the Case of the Disappearing Exceptions
Posted by
Travis Reeder
at
12:35 AM
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment