Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/356#discussion_r81123434 --- Diff: core/src/main/java/org/apache/brooklyn/core/entity/lifecycle/ServiceStateLogic.java --- @@ -153,6 +153,26 @@ private ServiceStateLogic() {} } public static void setExpectedState(Entity entity, Lifecycle state) { + waitForServiceUpIfStateIsRunning(entity, state); + ((EntityInternal)entity).sensors().set(Attributes.SERVICE_STATE_EXPECTED, new Lifecycle.Transition(state, new Date())); + + Maybe<Enricher> enricher = EntityAdjuncts.tryFindWithUniqueTag(entity.enrichers(), ComputeServiceState.DEFAULT_ENRICHER_UNIQUE_TAG); + if (enricher.isPresent() && enricher.get() instanceof ComputeServiceState) { + ((ComputeServiceState)enricher.get()).onEvent(null); + } + } + public static Lifecycle getExpectedState(Entity entity) { + Transition expected = entity.getAttribute(Attributes.SERVICE_STATE_EXPECTED); + if (expected==null) return null; + return expected.getState(); + } + + public static void setActualState(Entity entity, Lifecycle state) { --- End diff -- Let's delete `setActualState`: it's not used. The pattern used is to set the expected state, and then for the actual state to be inferred by an enricher.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---