comments on Executor
Sat, 2 Feb 2002 14:41:50 -0800
I view RunnableTask / Executor as the analog of java.util.TimerTask / Timer.
The TimerTask's cancel method works as a latch that can only prevent a task
from running -- but not actively stop a running task. However,
implementations can still override cancel to detect isCancelled and to do
something more proactive.
If RunnableTask.cancel is intended to do something different, we should
change the name to avoid confusion with TimerTask. (However, I'm OK with
----- Original Message -----
From: "Mark D. Anderson" <email@example.com>
Sent: Saturday, February 02, 2002 2:09 PM
Subject: Re: comments on Executor
> If you do want something heavier than a simple cancelled bit,
> you can actually interrupt the thread inside cancel. As in:
i think we need to clarify purposes, perhaps by changing the function names:
1. a cancel() which is a method somehow connected to an Executor which
a started task. This means it should:
- do the appropriate things in the Executor data structures
- call any hook methods in the particular runnable/future
- carry out whatever the Executor's thread interruption policy is
(interrupt, kill, etc.)
2. like (1), except for a task that has no yet been started. Its behavior is
similar to (1).
3. a cancel() which is the hook method of a particular Callable/Future
which implements how it'd like to cancel an operation that has been started.