Apache9 commented on a change in pull request #3495:
URL: https://github.com/apache/hbase/pull/3495#discussion_r672312582
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerCall.java
##########
@@ -175,23 +178,17 @@ private void release(int mask) {
}
}
- @Override
- public void cleanup() {
- release(0b01);
+ public void retainByWAL() {
+ reference.incrementAndGet();
}
- public void retainByWAL() {
- for (;;) {
- int ref = reference.get();
- int nextRef = ref | 0b10;
- if (reference.compareAndSet(ref, nextRef)) {
- return;
+ public void releaseByWAL() {
+ if (reference.decrementAndGet() == 0) {
Review comment:
I suggest we add some comments here, to say that decrementAndGet still
work even if the highest bit is 1, which means we are decrementing a negative
value. I was confused at first but then I realized that the arithmetic is the
same for positive and negative value.
--
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]