Small API Tweak to Task (Worker)

Richard Bair richard.bair at oracle.com
Thu Sep 26 13:39:21 PDT 2013


What are some examples of tasks that would not be cancelable?

Richard

On Sep 2, 2013, at 9:13 AM, Sven Reimers <sven.reimers at gmail.com> wrote:

> Hi,
> 
> I am trying to build a UI representation of a Task (using a ProgressBar and
> other things).
> 
> Since Tasks are cancellabe I thought about adding a button to cancel the
> underlying Task. So far so good.
> 
> Is there any reason why a Task can not express, if it is intended for the
> task to act cooperative to a call to cancel? Something along the following
> lines
> 
> public boolean isCancellable() { return true; }  // default
> 
> This would enable users of the API to distinguish between Tasks which
> really can be cancelled from those which just fulfill the API contract.
> 
> Comments?
> 
> -Sven
> 
> -- 
> Sven Reimers
> 
> * Senior Expert Software Architect
> * NetBeans Dream Team Member: http://dreamteam.netbeans.org
> * Community Leader  NetBeans: http://community.java.net/netbeans
>                              Desktop Java:
> http://community.java.net/javadesktop
> * Duke's Choice Award Winner 2009
> * Blog: http://nbguru.blogspot.com
> 
> * XING: https://www.xing.com/profile/Sven_Reimers8
> * LinkedIn: http://www.linkedin.com/in/svenreimers
> 
> Join the NetBeans Groups:
> * XING: http://www.xing.com/group-20148.82db20
> * NUGM: http://haug-server.dyndns.org/display/NUGM/Home
> * LinkedIn: http://www.linkedin.com/groups?gid=1860468
>                   http://www.linkedin.com/groups?gid=107402
>                   http://www.linkedin.com/groups?gid=1684717
> * Oracle: https://mix.oracle.com/groups/18497



More information about the openjfx-dev mailing list