brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <>
Subject [GitHub] brooklyn-server pull request #480: Config self reference fix
Date Tue, 28 Feb 2017 16:42:34 GMT
Github user ahgittin commented on a diff in the pull request:
    --- Diff: core/src/main/java/org/apache/brooklyn/util/core/task/
    @@ -96,7 +98,50 @@ public ExecutionManager getExecutionManager() {
         /** returns tasks started by this context (or tasks which have all the tags on this
object) */
         public Set<Task<?>> getTasks() { return executionManager.getTasksWithAllTags(tags);
    +    /** performs execution without spawning a new task thread, though it does temporarily
set a fake task for the purpose of getting context;
    +     * currently supports suppliers or callables  */
    +    @SuppressWarnings("unchecked")
    +    @Override
    +    public <T> Maybe<T> getImmediately(Object callableOrSupplier) {
    +        BasicTask<?> fakeTaskForContext;
    +        if (callableOrSupplier instanceof BasicTask) {
    +            fakeTaskForContext = (BasicTask<?>)callableOrSupplier;
    --- End diff --
    as noted above leaving the task running in background (or possibly not submitting it)
is the right thing to do for immediate execution of a task; cancelling it is risky unless
we know the task is dedicated to this one usage (hence preferring `TaskFactory`); in particular
`EntityConfigTest.testGetTaskNonBlockingKey()` fails if `allowImmediateExecution=true`

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 or file a JIRA ticket
with INFRA.

View raw message