Skip to content

replace submit with execute#336

Merged
marianobarrios merged 2 commits intomarianobarrios:masterfrom
strogiyotec:replaceSubmitWithExecute
Feb 23, 2026
Merged

replace submit with execute#336
marianobarrios merged 2 commits intomarianobarrios:masterfrom
strogiyotec:replaceSubmitWithExecute

Conversation

@strogiyotec
Copy link
Copy Markdown

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 submit wasn't used

Mongodb-java-driver has a similar PR to replace all calls in AsyncTlsChannelGroup from submit to execute whenever the Future produced by submit isn't used

Mongo java driver replaced ExecutorService.submit with Executor.execute because 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

In AsyncTlsChannelGroup replace the call to executor submit with
executor execute
@strogiyotec strogiyotec force-pushed the replaceSubmitWithExecute branch from 62b2ca0 to facc4ff Compare February 23, 2026 15:50
@marianobarrios marianobarrios merged commit 0707bec into marianobarrios:master Feb 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants