mattisonchao commented on code in PR #19341:
URL: https://github.com/apache/pulsar/pull/19341#discussion_r1089722397
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -1208,19 +1211,23 @@ public void
asyncFindNewestMatching(FindPositionConstraint constraint, Predicate
@Override
public void setActive() {
- if (!alwaysInactive) {
+ if (!isActive && !alwaysInactive) {
ledger.activateCursor(this);
+ isActive = true;
}
}
@Override
public boolean isActive() {
- return ledger.isCursorActive(this);
+ return isActive;
}
@Override
public void setInactive() {
- ledger.deactivateCursor(this);
+ if (isActive) {
+ ledger.deactivateCursor(this);
+ isActive = false;
Review Comment:
there is still the possibility of inconsistent status in the concurrent
scenario, but I'm not sure whether it is a problem.
--
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]