yifan-c commented on code in PR #4514:
URL: https://github.com/apache/cassandra/pull/4514#discussion_r2590532194
##########
src/java/org/apache/cassandra/db/compression/ZstdCompressionDictionary.java:
##########
@@ -181,30 +195,48 @@ public Ref<ZstdCompressionDictionary> ref()
return selfRef.ref();
}
- @Override
- public void close()
+ private void ensureNotReleased()
{
- if (closed.compareAndSet(false, true))
- {
- selfRef.release();
- }
+ if (selfRef.globalCount() <= 0)
Review Comment:
It should not be negative. Using `<= 0` is more for defensive reasons, and
be consistent with `Ref.GlobalState#ref`. The count can be `-1`, but
`globalCount()` method adds 1 when returning.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]