michaeljmarshall opened a new pull request, #19670: URL: https://github.com/apache/pulsar/pull/19670
### Motivation The `DirectProxyHandler` and the `ProxyConnection` are run in the same event loop to prevent context switching. As such, we do not need to schedule an event onto an event loop that is in fact the same event loop. Further, scheduling on that event loop could have resulted in uncaught failures because the method was run without any error handling. Additionally, we can use `assert` to verify that we are in the event loop. Netty makes extensive use of this paradigm, as described in this PR #19653. The primary benefit here is that we skip some unnecessary volatile reads when running the code in production. ### Modifications * Replace `checkState` with `assert` in `ProxyConnection` class * Remove unnecessary event execution in callback when starting up the `DirectProxyHandler`. ### Verifying this change This change is covered by the assertions that are added. ### Does this pull request potentially affect one of the following parts: This is a minor improvement that should not break anything. ### Documentation - [x] `doc-not-needed` ### Matching PR in forked repository PR in forked repository: https://github.com/michaeljmarshall/pulsar/pull/33 -- 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]
