Repository: brooklyn-server Updated Branches: refs/heads/master 257926534 -> 20c6b1e00
Fix Entities.UNCHANGED marker, for rebind Previously, after rebind then enrichers using this would have their own copy of their object (due to xstream deserialisation). Instead, use an enum. This does not fix the problem for existing persisted state of enrichers that have their own object! Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/1455bbef Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/1455bbef Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/1455bbef Branch: refs/heads/master Commit: 1455bbefabf610132c60c2f89a1c3e78a3d45f8e Parents: 1f2e2a1 Author: Aled Sage <[email protected]> Authored: Wed Jul 6 13:16:29 2016 +0100 Committer: Aled Sage <[email protected]> Committed: Wed Jul 6 13:16:29 2016 +0100 ---------------------------------------------------------------------- .../java/org/apache/brooklyn/core/entity/Entities.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1455bbef/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java b/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java index 1909845..2821652 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java @@ -144,19 +144,26 @@ public class Entities { "access.cert", "access.key"); + // Don't use `new Object()` - deserialization creates a different object from the constant. + // Instead, use this enum. + private enum ValueMarkers { + UNCHANGED, + REMOVE; + } + /** * Special object used by some setting methods to indicate that a value should be ignored. * <p> * See specific usages of this field to confirm where. */ - public static final Object UNCHANGED = new Object(); + public static final Object UNCHANGED = ValueMarkers.UNCHANGED; /** * Special object used by some setting methods to indicate that a value should be removed. * <p> * See specific usages of this field to confirm where. */ - public static final Object REMOVE = new Object(); + public static final Object REMOVE = ValueMarkers.REMOVE; /** * Invokes an {@link Effector} on multiple entities, with the named arguments from the parameters {@link Map}
