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

    https://github.com/apache/incubator-brooklyn/pull/1160#discussion_r50317829
  
    --- Diff: 
brooklyn-server/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionManager.java
 ---
    @@ -665,9 +728,27 @@ protected void internalBeforeStart(Map<?,?> flags, 
Task<?> task) {
                 PerThreadCurrentTaskHolder.perThreadCurrentTask.set(task);
                 
((TaskInternal<?>)task).setStartTimeUtc(System.currentTimeMillis());
             }
    -        ExecutionUtils.invoke(flags.get("newTaskStartCallback"), task);
    +        invokeCallback(flags.get("newTaskStartCallback"), task);
         }
     
    +    @SuppressWarnings({ "unchecked", "rawtypes" })
    +    // not ideal, such loose typing on the callback -- should prefer 
Function<Task,Object>
    +    // but at least it's package-private
    +    static Object invokeCallback(Object callable, Task<?> task) {
    +        if (callable instanceof Closure) return 
((Closure<?>)callable).call(task);
    +        if (callable instanceof Callable) {
    +            try {
    +                return ((Callable<?>)callable).call();
    +            } catch (Throwable t) {
    +                throw Throwables.propagate(t);
    --- End diff --
    
    good spot -- this code was moved but worth improving


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to