brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bostko <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #266: BROOKLYN-264: refactor wait-for-provision
Date Tue, 19 Jul 2016 06:34:07 GMT
Github user bostko commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/266#discussion_r71279013
  
    --- Diff: software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java
---
    @@ -379,20 +418,30 @@ public MachineLocation call() throws Exception {
                 if (!(location instanceof LocalhostMachineProvisioningLocation))
                     log.info("Starting {}, obtaining a new location instance in {} with ports
{}", new Object[]{entity(), location, flags.get("inboundPorts")});
                 entity().sensors().set(SoftwareProcess.PROVISIONING_LOCATION, location);
    +            Transition expectedState = entity().sensors().get(Attributes.SERVICE_STATE_EXPECTED);
    +            
    +            // BROOKLYN-263: see corresponding code in doStop()
    +            if (expectedState != null && (expectedState.getState() == Lifecycle.STOPPING
|| expectedState.getState() == Lifecycle.STOPPED)) {
    +                throw new IllegalStateException("Provisioning aborted before even begun
for "+entity()+" in "+location+" (presumably by a concurrent call to stop");
    +            }
    +            entity().sensors().set(PROVISIONING_TASK_STATE, ProvisioningTaskState.RUNNING);
    +            
                 MachineLocation machine;
                 try {
                     machine = Tasks.withBlockingDetails("Provisioning machine in " + location,
new ObtainLocationTask(location, flags));
    -                if (machine == null)
    -                    throw new NoMachinesAvailableException("Failed to obtain machine
in " + location.toString());
    -            } catch (Exception e) {
    -                throw Exceptions.propagate(e);
    +                entity().sensors().set(PROVISIONED_MACHINE, machine);
    --- End diff --
    
    I was thinking about this option but doesn't feel like the best option.
    The downside I see is that someone could start using this sensor instead of `getLocations()`.


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

Mime
View raw message