Github user neykov commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/131#discussion_r16907284
--- Diff: core/src/main/java/brooklyn/entity/basic/AbstractApplication.java
---
@@ -123,23 +137,29 @@ public AbstractApplication setParent(Entity parent) {
public void start(Collection<? extends Location> locations) {
this.addLocations(locations);
Collection<? extends Location> locationsToUse = getLocations();
- setAttribute(Attributes.SERVICE_STATE, Lifecycle.STARTING);
+ ServiceProblemsLogic.clearProblemsIndicator(this, START);
+ ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING);
+ ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this,
Attributes.SERVICE_STATE_ACTUAL, "Application starting");
recordApplicationEvent(Lifecycle.STARTING);
try {
preStart(locationsToUse);
+ // if there are other items which should block service_up,
they should be done in preStart
+ ServiceStateLogic.ServiceNotUpLogic.clearNotUpIndicator(this,
Attributes.SERVICE_STATE_ACTUAL);
+
doStart(locationsToUse);
postStart(locationsToUse);
} catch (Exception e) {
- setAttribute(Attributes.SERVICE_STATE, Lifecycle.ON_FIRE);
+ // TODO should probably remember these problems then clear?
if so, do it here ... or on all effectors?
+// ServiceProblemsLogic.updateProblemsIndicator(this, START, e);
+
recordApplicationEvent(Lifecycle.ON_FIRE);
// no need to log here; the effector invocation should do that
throw Exceptions.propagate(e);
+ } finally {
+ ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING);
--- End diff --
If we set SERVICE_STATE_EXPECTED to ON_FIRE in the above catch clause this
will overwrite it. So seems the better approach is to use the commented
updateProblemsIndicator(this, START, e);
---
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 [email protected] or file a JIRA ticket
with INFRA.
---