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_r140607801
  
    --- Diff: core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java
---
    @@ -100,6 +123,121 @@ public ExecutionManager getExecutionManager() {
         @Override
         public Set<Task<?>> getTasks() { return executionManager.getTasksWithAllTags(tags);
}
     
    +    @Override
    +    public <T> T get(TaskAdaptable<T> task) {
    +        final TaskInternal<T> t = (TaskInternal<T>) task.asTask();
    +        
    +        if (t.isQueuedOrSubmitted()) {
    +            if (t.isDone()) {
    +                return t.getUnchecked();
    +            } else {
    +                throw new ImmediateUnsupportedException("Task is in progress and incomplete:
"+t);
    --- End diff --
    
    I don't follow - why does `get(task)` expect it to be already done if it's submitted?
In a future/task/executor api, I'd assume `.get()` would block. I think that's what the javadoc
says. Am I misreading this code?


---

Mime
View raw message