On 7/13/2010 1:10 AM, Peter Firmstone wrote:
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.

The Task is a Runnable, and has a Runnable's inherent power to wrap the
body of its run method in a try-catch. The problem I'm concerned about
is the handling of disastrous Throwables, such as VirtualMachineError.
Those are not normally caught, so I would not expect the Task to catch them. A warning log message seems an under-reaction.

I've realized we will never get InterruptedException from calling the
run method, because it is not an Error or a RuntimeException.

Patricia

Reply via email to