brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [44/50] brooklyn-server git commit: Fix AtomicReference.setIfDifferent
Date Mon, 01 Feb 2016 17:49:30 GMT
Fix AtomicReference.setIfDifferent

- was using != instead of .equals for object equality


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/bf2e4c36
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/bf2e4c36
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/bf2e4c36

Branch: refs/heads/0.5.0
Commit: bf2e4c36f7ab4dc193d911dcb436e9211447e9da
Parents: 6ea7b07
Author: Aled Sage <aled.sage@gmail.com>
Authored: Wed Apr 24 10:54:48 2013 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Thu Apr 25 11:25:06 2013 +0100

----------------------------------------------------------------------
 core/src/main/java/brooklyn/util/javalang/AtomicReferences.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/bf2e4c36/core/src/main/java/brooklyn/util/javalang/AtomicReferences.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/util/javalang/AtomicReferences.java b/core/src/main/java/brooklyn/util/javalang/AtomicReferences.java
index fb03d91..ed10d28 100644
--- a/core/src/main/java/brooklyn/util/javalang/AtomicReferences.java
+++ b/core/src/main/java/brooklyn/util/javalang/AtomicReferences.java
@@ -3,6 +3,7 @@ package brooklyn.util.javalang;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
+import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Supplier;
 
@@ -15,7 +16,7 @@ public class AtomicReferences {
 
     /** sets the atomic reference to the given value, and returns whether there is any change
*/
     public static <T> boolean setIfDifferent(AtomicReference<T> ref, T value)
{
-        return ref.getAndSet(value) != value;
+        return !Objects.equal(ref.getAndSet(value), value);
     }
     
     /** returns the given atomic as a Supplier */


Mime
View raw message