dschneider-pivotal commented on a change in pull request #7396:
URL: https://github.com/apache/geode/pull/7396#discussion_r818951509



##########
File path: 
geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/RedisList.java
##########
@@ -92,6 +95,23 @@ public int llen() {
     return elementList.size();
   }
 
+  /**
+   * @param region the region to set on
+   * @param key the key to set on
+   * @param index the index specified by the user
+   * @param value the value to set
+   */
+  public void lset(Region<RedisKey, RedisData> region, RedisKey key, int 
index, byte[] value) {
+    int listSize = elementList.size();
+    int adjustedIndex = index >= 0 ? index : listSize + index;
+    if (adjustedIndex > listSize - 1 || adjustedIndex < 0) {
+      throw new RedisException(ERROR_INDEX_OUT_OF_RANGE);
+    }
+
+    elementList.set(adjustedIndex, value);

Review comment:
       you should use elementReplace here instead of elementList.set to give 
you the synchronization protection from a concurrent toData called by GII




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to