goxr3plus / XR3Player

🎧 🎼 The MOST ADVANCED JavaFX Media Player
https://xr3player.netlify.com/
GNU Lesser General Public License v3.0
724 stars 176 forks source link

Isn't there a better way to exit the application, than to call System.exit()? #57

Open HelgeStenstrom opened 5 years ago

HelgeStenstrom commented 5 years ago

https://github.com/goxr3plus/XR3Player/blob/b222ce496f47b1ffc121e768b4f3f24999906213/src/main/java/com/goxr3plus/xr3player/application/MainExit.java#L96

Calling System.exit() is a pretty brutal way of exiting. Most programs don't need that. Since this is a multithreaded program, you need to stop the execution of these threads. There are less brutal ways to do it, like, letting them exit the loops they are in, and run to their respective ends. Then they can be joined with the main thread.

Disclaimer: I'm much less experienced with multithreaded programming than you are. I might be wrong.

HelgeStenstrom commented 5 years ago

I guess my question is related to https://github.com/goxr3plus/java-stream-player/issues/15