lhotari commented on PR #4171: URL: https://github.com/apache/bookkeeper/pull/4171#issuecomment-1884658712
> At first I was thinking the same thing as you, it didn't seem like it should be happening. But in fact, these two threads can call two different `PendingAddOp` instances, and these two instances have the same `LedgerHandle` instance attribute. Synchronized for `PendingAddOp` does not block the same LedgerHandle `sendAddSuccessCallbacks` method of the instance is called, the `sendAddSuccessCallbacks` concurrent calls are not prevented. Makes sense. Just wondering if the logic really works correctly without making the sendAddSuccessCallbacks method synchronized. For example, on line 1831, the call to `pendingAddOps.remove()` seems to assume that it is the same instance that `pendingAddOps.peek()` returned on line 1814. The extensive usage of `synchronized` isn't nice, but there doesn't seem to be away around it? -- 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]
