replace submit with execute#336
Merged
marianobarrios merged 2 commits intomarianobarrios:masterfrom Feb 23, 2026
Merged
Conversation
In AsyncTlsChannelGroup replace the call to executor submit with executor execute
62b2ca0 to
facc4ff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original motivation for this PR is that we at mongo-java-driver had a bug where runnable submitted to executor service produced an exception that wasn't caught because Future produced by
submitwasn't usedMongodb-java-driver has a similar PR to replace all calls in AsyncTlsChannelGroup from
submittoexecutewhenever theFutureproduced bysubmitisn't usedMongo java driver replaced
ExecutorService.submitwithExecutor.executebecause only the latter allows an exception that originates from the executed task to be propagated as an uncaught exception (submit catches it and places in the returned Future, which we do not inspect). Once there is an uncaught exception, ThreadGroup.uncaughtException is called, which emits the information about the uncaught exception to the standard error stream.The above happens only if the thread does not have an explicit, UncaughtExceptionHandler, and there is no default uncaught exception handler.
Thus with this change, uncaught exceptions won't stay unnoticed anymore , at the very least the info about them will be emitted to the standard error stream