brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geomacy <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #520: Limit parallelism of start/stop steps on ...
Date Wed, 25 Jan 2017 11:21:29 GMT
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/520#discussion_r97756033
  
    --- Diff: software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java
---
    @@ -944,14 +1002,19 @@ protected static boolean canStop(StopMode stopMode, boolean isStopped)
{
                     stopMode == StopMode.IF_NOT_STOPPED && !isStopped;
         }
     
    +    /** @deprecated since 0.11.0. Use {@link #preStopConfirmCustom(AtomicReference)}
instead. */
    +    @Deprecated
    +    protected void preStopConfirmCustom() {
    +        preStopConfirmCustom(RELEASEABLE_LATCH_TL.get());
    +    }
    +
         /** 
          * Override to check whether stop can be executed.
          * Throw if stop should be aborted.
          */
    -    protected void preStopConfirmCustom() {
    +    protected void preStopConfirmCustom(AtomicReference<ReleaseableLatch> stopLatchRef)
{
             // Opportunity to block stop() until other dependent components are ready for
it
    -        Object val = entity().getConfig(SoftwareProcess.STOP_LATCH);
    -        if (val != null) log.debug("{} finished waiting for stop-latch {}; continuing...",
entity(), val);
    +        stopLatchRef.set(waitForLatch(entity(), SoftwareProcess.STOP_LATCH));
    --- End diff --
    
    Is it advisable to do this outside the protected method, to avoid possibility of subclasses
forgetting to call super(). - i.e. wrap the`protected` method in something `private` that
sets the latch reference then calls the protected method.  Perhaps this line should go into
`doStopLatching` just before the call to `doStop()`.  Same for the other latches, START etc.


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