dschneider-pivotal commented on a change in pull request #7418:
URL: https://github.com/apache/geode/pull/7418#discussion_r828320817
##########
File path:
geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/RedisList.java
##########
@@ -143,13 +143,19 @@ public long lpush(List<byte[]> elementsToAdd,
Region<RedisKey, RedisData> region
/**
* @param region the region this instance is stored in
- * @param key the name of the set to add to
+ * @param key the name of the list to add to
* @return the element actually popped
*/
public byte[] lpop(Region<RedisKey, RedisData> region, RedisKey key) {
- byte[] popped = elementRemove(0);
- RemoveElementsByIndex removed = new RemoveElementsByIndex();
- removed.add(0);
+ byte newVersion;
+ byte[] popped;
+ RemoveElementsByIndex removed;
+ synchronized (this) {
+ newVersion = incrementAndGetVersion();
+ popped = removeFirstElement();
+ removed = new RemoveElementsByIndex(newVersion);
Review comment:
you can end the sync block on line 155 (right after you call
removeFirstElement). The creation of the RemoveElementsByIndex can be outside
the sync
--
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]