Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/443#discussion_r89777765
--- Diff:
core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java ---
@@ -1225,4 +1235,93 @@ private void
assertFirstAndNonFirstCounts(Collection<Entity> members, int expect
assertEquals(found.size(), expectedNonFirstCount);
}
+ @DataProvider
+ public Object[][] maxConcurrentCommandsTestProvider() {
+ return new Object[][]{{1}, {2}, {3}};
+ }
+
+ @Test(dataProvider = "maxConcurrentCommandsTestProvider")
+ public void
testEntitiesStartAndStopSequentiallyWhenMaxConcurrentCommandsIsOne(int
maxConcurrentCommands) {
--- End diff --
I wonder what the changes are of this failing without your semaphore. The
problem is that the work done inside the `start()` method (between the
increment + decrement of the counter) is pretty small. We're probably ok with
10 entities and such a small `maxConcurrentCommands` but still...
I'm loathe to suggest it, but maybe we want to configure the entity with a
very short sleep in the middle of `start()`. Even just a few milliseconds would
force the thread to yield, and thus make the concurrent commands much more
likely to try to execute.
Up to you whether you think that's worth it.
---
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.
---