kezhuw commented on code in PR #478:
URL: https://github.com/apache/curator/pull/478#discussion_r1313840755


##########
curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java:
##########
@@ -196,7 +196,7 @@ public boolean trySetValue(VersionedValue<byte[]> previous, 
byte[] newValue) thr
     private void updateValue(int version, byte[] bytes) {
         while (true) {
             VersionedValue<byte[]> current = currentValue.get();
-            if (current.getVersion() >= version) {
+            if (current.getVersion() >= version && version != 
Integer.MIN_VALUE) {

Review Comment:
   I guess `-1` was chose as `UNINITIALIZED_VERSION` because of it is minimum 
in absent of overflow. So, now we can have `Integer.MIN_VALUE` as 
`UNINITIALIZED_VERSION` 😮‍💨 .



##########
curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java:
##########
@@ -196,7 +196,7 @@ public boolean trySetValue(VersionedValue<byte[]> previous, 
byte[] newValue) thr
     private void updateValue(int version, byte[] bytes) {
         while (true) {
             VersionedValue<byte[]> current = currentValue.get();
-            if (current.getVersion() >= version) {
+            if (current.getVersion() >= version && version != 
Integer.MIN_VALUE) {

Review Comment:
   I guess `-1` was chose as `UNINITIALIZED_VERSION` because of it is minimum 
in absent of overflow. So, now we can have `Integer.MIN_VALUE` as 
`UNINITIALIZED_VERSION` 😮‍💨 .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@curator.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to