From 890d70a8366314c7ccc825b92960e3b8a7ce327d Mon Sep 17 00:00:00 2001 From: Kezhu Wang Date: Mon, 7 Apr 2025 12:33:45 +0800 Subject: [PATCH] Document read effects after SharedValue.setValue Closes #1254. --- .../curator/framework/recipes/shared/SharedCount.java | 8 +++++++- .../curator/framework/recipes/shared/SharedValue.java | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java index 2ecc528e4..b9de863cc 100644 --- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java +++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java @@ -65,7 +65,10 @@ public VersionedValue getVersionedValue() { } /** - * Change the shared count value irrespective of its previous state + * Change the shared count value irrespective of its previous state. + * + *

Later {@link #getCount()} will get some more updated value, whether that value is set + * by this session or a different one cannot be guaranteed though. * * @param newCount new value * @throws Exception ZK errors, interruptions, etc. @@ -100,6 +103,9 @@ public boolean trySetCount(int newCount) throws Exception { * value is updated. i.e. if the count is not successful you can get the updated value * by calling {@link #getCount()}. * + *

Later {@link #getCount()} will get some more updated value, whether that value is set + * by this session or a different one cannot be guaranteed though. + * * @param newCount the new value to attempt * @return true if the change attempt was successful, false if not. If the change * was not successful, {@link #getCount()} will return the updated value diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java index ddb96fcc2..c52750c99 100644 --- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java +++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java @@ -130,7 +130,10 @@ public VersionedValue getVersionedValue() { } /** - * Change the shared value irrespective of its previous state + * Change the shared value irrespective of its previous state. + * + *

Later {@link #getValue()} will get some more updated value, whether that value is set + * by this session or a different one cannot be guaranteed though. * * @param newValue new value * @throws Exception ZK errors, interruptions, etc. @@ -168,6 +171,9 @@ public boolean trySetValue(byte[] newValue) throws Exception { * value is updated. i.e. if the value is not successful you can get the updated value * by calling {@link #getValue()}. * + *

Later {@link #getValue()} will get some more updated value, whether that value is set + * by this session or a different one cannot be guaranteed though. + * * @param newValue the new value to attempt * @return true if the change attempt was successful, false if not. If the change * was not successful, {@link #getValue()} will return the updated value