-
Notifications
You must be signed in to change notification settings - Fork 83
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
Process Listener API #413
Process Listener API #413
Conversation
@Speiger thank you for submitting this PR. Could you clarify why custom implementation of
This link may be useful: https://fw-geekycoder.blogspot.com/2014/01/how-to-force-kill-process-in-java.html |
@kokorin the reason why it is not enough is: Also i realized i shouldn't have used github code spaces to do this step.
Unless you implement a finalize method (which is depricated at this point) that will not work. Since i had already cases in my app where i started 20 ish heavy FFmpeg tasks and killed the JVM task by closing the app (which triggered a System.exit(0) in my impl) and the program kept running even so the jvm task was stopped gracefully.
I am running in Java21 with my application, and from what I have seen is: ForceDestroy simply calls destroy and does nothing else in the implementation. There are also no indicators that there is a different implementation present either. From what i figured out, Process:destroy is working just fine. |
Could you clarify a bit how it should work? I mean how that external tracker actually tracks and kills sub-process?
It's also possible to use JVM shutdown hook for that.
Originally it was the approach for Stopper. But it didn't work all the times, I don't already remember details, sorry.
Could you clarify how having |
My implementation is simply a ConcurrentSet for example, that keeps track of all tasks, Tracking for example means ram usage/CPU usage of a process using the OSHI library.
Still a hook where the devs could decide which processes have to be waited for and which not would be nice :)
That's also a way, but a more demanding on you which why we suggested giving access for those who want to manage it themselves and give you less work :)
It would allow us to track more than "Oh its running or its now finished" with the Oshi library we can also track its memory usage, cpu usage, writing/reading etc. Again this is just a accessibility suggestion that reduces the work you have to do to the bare minimum so people can do stuff if they want to and you can still maintain it easily :) |
@Speiger sorry for late reply, you convinced me. Please, pay attention that:
|
@kokorin yeah that's totally fine. |
Closing because #416 |
Creates a Listener API for Process instances done by this library. That way giving library users more control over how processes are stopped.
The Stopper API itself never guarantees that the Processes are stopped and this assures that the guarantee can be self implemented.
Edit: This should solve #383