dschneider-pivotal commented on a change in pull request #6776:
URL: https://github.com/apache/geode/pull/6776#discussion_r693031998
##########
File path:
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/AbstractRedisData.java
##########
@@ -168,18 +168,19 @@ public void fromData(DataInput in, DeserializationContext
context)
expirationTimestamp = in.readLong();
}
- private void setDelta(DeltaInfo deltaInfo) {
- this.deltaInfo = deltaInfo;
+ private void setDelta(DeltaInfo newDeltaInfo) {
+ deltaInfo.set(newDeltaInfo);
}
@Override
public boolean hasDelta() {
- return deltaInfo != null;
+ return deltaInfo.get() != null;
}
@Override
public void toDelta(DataOutput out) throws IOException {
- deltaInfo.serializeTo(out);
+ deltaInfo.get().serializeTo(out);
+ deltaInfo.remove();
Review comment:
don't call remove here. It you look at storeChanges you will see it
already calls setDelta(null) in a finally block. By calling ThreadLocal.remove
here you just cause setDelta(null) to recreate an entry in the thread local map.
I think we should not call ThreadLocal.remove at all and the current call of
setDelta(null) on storeChanges is all we need
--
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]