I have a tool that is launched and called through a BAT file on the command line. In the tool, the Quartz scheduler periodically calls a method that executes the logic.
According to the current implementation, all this is done through a single thread, so even if CTRL + C is executed in a BAT file, the tool does not end until the process ends.
But, looking at the process, we came up with the idea of performing part of the process in a separate thread. Here, the main thread would create a new thread that would continue to perform some time-consuming operations, and the parent thread would die. And another thread can be started by quartz before the end of the daughter thread.
Thus, at that time, there can only be one parent thread created by Quartz, but there can be any number of child threads.
In the above scenario, if CTRL + C is executed, then the Quartz scheduler waits for the parent thread to complete before completion, and all other threads remain incomplete.
I would really appreciate it if someone could tell me how the tool can be saved until all threads are complete.
Thanks in advance.
PS: I tried to bind the newly created child threads as stop hooks, but it doesn't seem to solve my problem. Maybe I'm doing it wrong, but so far it has not helped me.
source
share