diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/DynamicSentinelProperty.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/DynamicSentinelProperty.java index a72c3d0c..c1437105 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/DynamicSentinelProperty.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/DynamicSentinelProperty.java @@ -46,9 +46,9 @@ public class DynamicSentinelProperty implements SentinelProperty { } @Override - public void updateValue(T newValue) { + public boolean updateValue(T newValue) { if (isEqual(value, newValue)) { - return; + return false; } RecordLog.info("[DynamicSentinelProperty] Config will be updated to: " + newValue); @@ -56,7 +56,7 @@ public class DynamicSentinelProperty implements SentinelProperty { for (PropertyListener listener : listeners) { listener.configUpdate(newValue); } - + return true; } private boolean isEqual(T oldValue, T newValue) { diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/NoOpSentinelProperty.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/NoOpSentinelProperty.java index c1a704fc..78a5db2a 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/NoOpSentinelProperty.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/NoOpSentinelProperty.java @@ -21,6 +21,7 @@ package com.alibaba.csp.sentinel.property; * @author leyou */ public final class NoOpSentinelProperty implements SentinelProperty { + @Override public void addListener(PropertyListener listener) { } @@ -28,5 +29,7 @@ public final class NoOpSentinelProperty implements SentinelProperty { public void removeListener(PropertyListener listener) { } @Override - public void updateValue(Object newValue) { } + public boolean updateValue(Object newValue) { + return true; + } } diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/SentinelProperty.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/SentinelProperty.java index c71d9eb5..752e3344 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/SentinelProperty.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/property/SentinelProperty.java @@ -56,6 +56,7 @@ public interface SentinelProperty { * added on this only when new {@code newValue} is not Equals to the old value. * * @param newValue the new value. + * @return true if the value in property has been updated, otherwise false */ - void updateValue(T newValue); + boolean updateValue(T newValue); }