Christopher Kin Chung Au wrote:
> The idea of what I am trying to do is to
> have a parent futuretask which creates multiple child futures. When I
> overrode the the done method on the parent futuretask and called
> cancel the done method does not get called immediate even though the
> iscancelled method and isdone method both return true. The overridden
> done method only gets called when all the child futures have finished
> executing. Is there somthing I am doing wrong???
>
The done method fires only when the task's run/call method returns,
not upon calling cancel. Apparently your parent tasks are written not
to return until child tasks complete.
If you require that cancelling a parent task should also cancel child
tasks, then you can override FutureTask.cancel (or make your own
custom Future implementation) to do this.
Also, your tasks should all make sure to be responsive to interrupts, perhaps by
interspersing "if (Thread.interrupted()) return..." as needed.
-Doug
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest