brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Support suspending machines
Date Fri, 31 Jul 2015 08:44:45 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/763#discussion_r35956185
  
    --- Diff: software/base/src/main/java/brooklyn/entity/software/MachineLifecycleEffectorTasks.java
---
    @@ -155,29 +155,42 @@ public void attachLifecycleEffectors(Entity entity) {
                     .build();
         }
     
    +    /** @see {@link #newStartEffector()} */
    +    public Effector<Void> newSuspendEffector() {
    +        return Effectors.effector(Void.class, "suspend")
    +                .description("Suspend the process/service represented by an entity")
    +                .parameter(StopSoftwareParameters.STOP_PROCESS_MODE)
    +                .parameter(StopSoftwareParameters.STOP_MACHINE_MODE)
    +                .impl(newSuspendEffectorTask())
    +                .build();
    +    }
    +
         /**
    -     * Returns the {@link TaskFactory} which supplies the implementation for the start
effector.
    +     * Returns the {@link EffectorBody} which supplies the implementation for the start
effector.
          * <p>
          * Calls {@link #start(Collection)} in this class.
          */
         public EffectorBody<Void> newStartEffectorTask() {
    -        return new EffectorBody<Void>() {
    -            @Override
    -            public Void call(ConfigBag parameters) {
    -                Collection<? extends Location> locations  = null;
    +        return new StartEffectorBody();
    --- End diff --
    
    This will break rebinding as the anonymous classes will be needed when reconstructing
the entities. The approach used to keep backwards compatibility in similar cases is to keep
the methods creating the anonymous classes but not use them, i.e. rename to newStartEffectorTaskDeprecated
and change its visibility to private. Only needed for the newXXXEffectorTask methods. Once
apache#738 is merged one could instead add code to do the rename on the fly.
    Apologies for writing this late, was just able to review this.


---
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