-
-
Notifications
You must be signed in to change notification settings - Fork 269
Description
Hello @rbygrave ,
In our application, we have a scheduler that starts multiple threads in parallel for various tasks that can be completed independently of each other (e.g. importing customers, evaluating user logins, etc.).
It's also possible for users to cancel/abort such tasks in the UI.
Aborting involves the scheduler sending an interrupt signal to the Java threads.
We have the problem that the threads often just keep running and don't notice the interrupt because they're busy executing DB actions.
We've been considering whether it would be useful to implement a mechanism in a very central location in ebean and/or ebean-datasource that detects whether the thread has been interrupted and:
- If there isn't an open transaction yet, it would prevent ebean-datasource from releasing the connection: thread interrupted FOCONIS/ebean-datasource#7
- If you're working in an open (large) transaction, you won't be able to access the internal connection: Thread interrupt FOCONIS/ebean#122
We'd like to ask for your opinion on what you would do regarding interrupts. Are we thinking in the right direction?
We've read this article regarding Thread.interrupt(): https://medium.com/@AlexanderObregon/javas-thread-interrupt-method-explained-0df0f8f6a428