eolivelli commented on a change in pull request #12190:
URL: https://github.com/apache/pulsar/pull/12190#discussion_r716409181
##########
File path:
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/coordination/impl/ResourceLockImpl.java
##########
@@ -218,18 +205,22 @@ synchronized void lockWasInvalidated() {
if (revalidateAfterReconnection) {
revalidateAfterReconnection = false;
log.warn("Revalidate lock at {} after reconnection", path);
- return revalidate();
+ return revalidate(value);
} else {
return CompletableFuture.completedFuture(null);
}
}
- synchronized CompletableFuture<Void> revalidate() {
+ synchronized CompletableFuture<Void> revalidate(T newValue) {
return store.get(path)
.thenCompose(optGetResult -> {
if (!optGetResult.isPresent()) {
// The lock just disappeared, try to acquire it again
- return acquireWithNoRevalidation()
+ synchronized (ResourceLockImpl.this) {
Review comment:
May it be useful to have a synchonized setVersion() method to reduce
code duplication and it will make code more readable?
--
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]