brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <>
Subject [GitHub] incubator-brooklyn pull request: Deploy across an entire web clust...
Date Tue, 29 Jul 2014 11:58:33 GMT
Github user aledsage commented on a diff in the pull request:
    --- Diff: software/webapp/src/main/java/brooklyn/entity/webapp/
    @@ -127,4 +158,140 @@ protected boolean calculateServiceUp() {
             return up;
    +    // TODO this will probably be useful elsewhere ... but where to put it?
    +    /** Waits for the given target to report service up, then runs the given task
    +     * (often an invocation on that entity), with the given name.
    +     * If the target goes away, this task marks itself inessential
    +     * before failing so as not to cause a parent task to fail. */
    +    static <T> Task<T> whenServiceUp(final Entity target, final TaskAdaptable<T>
task, String name) {
    +        return Tasks.<T>builder().name(name).dynamic(true).body(new Callable<T>()
    +            @Override
    +            public T call() {
    +                try {
    +                    while (true) {
    +                        if (!Entities.isManaged(target)) {
    +                            Tasks.markInessential();
    +                            throw new IllegalStateException("Target "+target+" is no
longer managed");
    +                        }
    +                        if (target.getAttribute(Attributes.SERVICE_UP)) {
    --- End diff --
    Can we instead use `DependentConfiguration.waitInTaskForAttributeReady`? Much of this
code feels like it's doing the same thing. I think the `waitInTaskForAttributeReady` impl
could benefit from checking `Entities.isManaged` that you have here - all the more reason
for this to delegate to a single impl.

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