Patricia Shanahan wrote:
I'm getting into writing a new TaskManager, and have a requirements
question. I expect I will have more of them as time goes on.
TaskManager logs and ignores any Throwable from a Task's run method.
This troubles me for a couple of reasons. Given the rule that an
interrupt is issued to each Thread during TaskManager termination, I
do not think InterruptedException should be loggable. On the other
hand, should we really be going on running, with just a Level.WARNING
log message, after a really bad JVM problem?
Patricia
I was thinking about that recently and thought that it should be
possible to ask a task it's status. If it has encountered an error, or
exception, that could be retrieved, similar to a RunnableFuture. Like
you have mentioned, not all exceptions should be caught. Have a look at
the comments in JoinManager, there's some interesting comments in there
that you might find relevant. If interrupted, it's possible it will be
run again.
Cheers,
Peter.