You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2016/11/07 15:08:57 UTC
[1/2] brooklyn-server git commit: Fix app.stop so doesn’t go on-fire briefly
Repository: brooklyn-server
Updated Branches:
refs/heads/master aa73099a0 -> 8f24d230e
Fix app.stop so doesn\u2019t go on-fire briefly
Previously in app.stop, we set the serviceUp=false before setting
expectedState=stopping. This meant there was a race where we could
briefly infer the actual state as on_fire.
This caused failure of SoftwareProcessEntityLatchTest.testStopLatchBlocks:
the attributeWhenReady latch would abort because it received an
event saying that the app was on_fire, so the stop_latch completely
immediately.
The fix is simple: in app.stop, set the expectedSate=stopping before
setting serviceUp=false.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/0070c6b4
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/0070c6b4
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/0070c6b4
Branch: refs/heads/master
Commit: 0070c6b417963018bbb1e4a86d1cedd1f249fc22
Parents: 7d9fe81
Author: Aled Sage <al...@gmail.com>
Authored: Fri Nov 4 17:34:55 2016 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Fri Nov 4 17:34:55 2016 +0000
----------------------------------------------------------------------
.../org/apache/brooklyn/core/entity/AbstractApplication.java | 2 +-
.../entity/software/base/SoftwareProcessEntityLatchTest.java | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0070c6b4/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
index 1c9c298..86c4cc4 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
@@ -200,9 +200,9 @@ public abstract class AbstractApplication extends AbstractEntity implements Star
public void stop() {
logApplicationLifecycle("Stopping");
+ setExpectedStateAndRecordLifecycleEvent(Lifecycle.STOPPING);
ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL, "Application stopping");
sensors().set(SERVICE_UP, false);
- setExpectedStateAndRecordLifecycleEvent(Lifecycle.STOPPING);
try {
doStop();
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0070c6b4/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityLatchTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityLatchTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityLatchTest.java
index ba62208..976a943 100644
--- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityLatchTest.java
+++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityLatchTest.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Set;
import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
import org.apache.brooklyn.api.entity.EntitySpec;
import org.apache.brooklyn.api.location.LocationSpec;
import org.apache.brooklyn.api.mgmt.Task;
@@ -126,7 +125,7 @@ public class SoftwareProcessEntityLatchTest extends BrooklynAppUnitTestSupport {
.configure(SoftwareProcess.STOP_LATCH, DependentConfiguration.attributeWhenReady(app, stopper)));
final Task<Void> startTask = Entities.invokeEffector(app, app, MyService.START, ImmutableMap.of("locations", ImmutableList.of(loc)));
- ((EntityLocal)triggerEntity).sensors().set(Attributes.SERVICE_UP, true);
+ triggerEntity.sensors().set(Attributes.SERVICE_UP, true);
startTask.get(Duration.THIRTY_SECONDS);
final Task<Void> stopTask = Entities.invokeEffector(app, app, MyService.STOP);
@@ -151,7 +150,7 @@ public class SoftwareProcessEntityLatchTest extends BrooklynAppUnitTestSupport {
assertDriverEventsEquals(entity, preLatchEvents);
assertFalse(task.isDone());
- ((EntityLocal)triggerEntity).sensors().set(Attributes.SERVICE_UP, true);
+ triggerEntity.sensors().set(Attributes.SERVICE_UP, true);
task.get(Duration.THIRTY_SECONDS);
assertDriverEventsEquals(entity, ImmutableList.of("setup", "copyInstallResources", "install", "customize", "copyRuntimeResources", "launch"));
}
[2/2] brooklyn-server git commit: This closes #406
Posted by al...@apache.org.
This closes #406
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/8f24d230
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/8f24d230
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/8f24d230
Branch: refs/heads/master
Commit: 8f24d230e6b15ca4e668fd4cf86a668676ff313b
Parents: aa73099 0070c6b
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 7 15:08:36 2016 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 7 15:08:36 2016 +0000
----------------------------------------------------------------------
.../org/apache/brooklyn/core/entity/AbstractApplication.java | 2 +-
.../entity/software/base/SoftwareProcessEntityLatchTest.java | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------