brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #816: Tasks code improvements - prep for better...
Date Thu, 28 Sep 2017 12:52:27 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/816#discussion_r141596718
  
    --- Diff: core/src/main/java/org/apache/brooklyn/util/core/task/BasicTask.java ---
    @@ -327,11 +328,10 @@ public synchronized boolean cancel(TaskCancellationMode mode) {
             return true;
         }
         
    -    @SuppressWarnings("deprecation")
         protected boolean doCancel(TaskCancellationMode mode) {
             if (internalFuture!=null) { 
    -            if (internalFuture instanceof ListenableForwardingFuture) {
    -                return ((ListenableForwardingFuture<?>)internalFuture).cancel(mode);
    +            if (internalFuture instanceof CancellingListenableForwardingFutureForTask)
{
    --- End diff --
    
    This kind of thing always looks like a bad code smell to me (instanceof and casting to
something declared in `BasicExecutionManager`). It is coupling the implementation of `BasicTask`
and `BasicExecutionManager` in ways that developers maintaining the project will not expect,
because there is no clear contract between the two classes.
    
    But we can live with it for now, rather than trying to change things more in this PR.


---

Mime
View raw message