Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/213#discussion_r18506942
--- Diff: core/src/main/java/brooklyn/entity/basic/ServiceStateLogic.java
---
@@ -114,6 +117,21 @@ private ServiceStateLogic() {}
}
public static void setExpectedState(Entity entity, Lifecycle state) {
+ if (state==Lifecycle.RUNNING) {
+ Boolean up =
((EntityInternal)entity).getAttribute(Attributes.SERVICE_UP);
+ if (!Boolean.TRUE.equals(up)) {
+ // pause briefly to allow any recent problem-clearing
processing to complete
+ Stopwatch timer = Stopwatch.createStarted();
+ boolean nowUp =
Repeater.create().every(Duration.millis(10)).limitTimeTo(Duration.millis(200)).until(entity,
--- End diff --
This isn't the code which fixes the race-failing test; that is elsewhere.
This simply helps minimise the impact of races elsewhere. I'd be in favour of
bumping the `log.debug` below up to `warn` (in the case where `SERVICE_UP` soon
becomes true), and perhaps explicitly run enrichers related to `SERVICE_UP`
computation before or instead of any wait.
---
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.
---