-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow TransactionOutboxImpl#scheduler and ExecutorSubmitter#executor programmatic shutdown #687
base: master
Are you sure you want to change the base?
Conversation
8e39a0a
to
8b649de
Compare
@reda-alaoui I don't understand why the change to Currently it doesn't control the lifetime of the supplied I think the right answer for the |
Do you consider like me that the |
I don't see why the Any A good rule of thumb is that whatever creates a resource should close it. |
0L, | ||
TimeUnit.MILLISECONDS, | ||
new ArrayBlockingQueue<Runnable>(16384))); | ||
return ExecutorSubmitter.builder().build(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@badgerwithagun ExecutorSubmitter
does not create an executor, but Submitter
does here. AutoCloseable
was originally added to Submitter
because of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you don't need to use this method.
You can just create a TransactionOutbox
with your own.
var outbox = TransactionOutbox.builder()
.submitter(ExecutorSubmitter.builder().executor(yourExecutor).build())
...
.builder();
This is almost always what you do in a managed environment. The default Submitter
implementation uses ForkJoinPool
, which is a very bad idea when running in an application container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
Fix #686
Makes
TransactionOutbox
andSubmitter
implementAutoCloseable
.Please note that if any instance is declared as a Spring bean, Spring will automatically call the close method on shutdown, which is very convenient.