You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by geomacy <gi...@git.apache.org> on 2018/02/19 15:37:59 UTC
[GitHub] brooklyn-library pull request #147: Adds AbstractController changeServerPool
Github user geomacy commented on a diff in the pull request:
https://github.com/apache/brooklyn-library/pull/147#discussion_r169108985
--- Diff: software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/AbstractControllerImpl.java ---
@@ -425,6 +443,20 @@ public void update() {
}
}
+ @Override
+ public void changeServerPool(String groupId) {
+ Group newGroup = (Group) getManagementContext().getEntityManager().getEntity(groupId);
+ if (newGroup == null) {
+ throw new IllegalArgumentException("Group '"+groupId+"' not found");
+ }
+
+ config().set(SERVER_POOL, newGroup);
+ if (hasServerPoolMemberTrackingPolicy()) {
--- End diff --
The behaviour here is a bit odd; if `serverPoolMemberTrackerPolicy` is `null`, then `hasServerPoolMemberTrackingPolicy` will iterate the `policies()` and if it finds a suitable policy will set it to `serverPoolMemberTrackerPolicy` and return true; so `addServerPoolMemberTrackingPolicy` will be called, which will promptly remove the `serverPoolMemberTrackerPolicy` and do another iteration through the `policies()`, so finding (presumably) the same one as just before and setting it again.
---