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:22 GMT
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))`


---

Mime
View raw message