Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/816#discussion_r141586350
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionManager.java
 ---
    @@ -253,8 +261,13 @@ protected boolean deleteTaskNonRecursive(Task<?> task) 
{
             }
             Task<?> removed = tasksById.remove(task.getId());
             incompleteTaskIds.remove(task.getId());
    -        if (removed!=null && removed.isSubmitted() && !removed.isDone()) {
    -            log.warn("Deleting submitted task before completion: 
"+removed+"; this task will continue to run in the background outwith "+this+", 
but perhaps it should have been cancelled?");
    +        if (removed!=null && removed.isSubmitted() && 
!removed.isDone(true)) {
    +            Entity context = BrooklynTaskTags.getContextEntity(removed);
    +            if (!Entities.isManaged(context)) {
    --- End diff --
    
    I think we should guard for null context (otherwise isManaged will throw 
NPE). I'd do `if (context != null && !Entities.isManaged(context))`


---

Reply via email to