Is there a concurrency structure (like a thread) in java which can execute runnables and be stopped and reexecuted, or do I have to implement it on my own?
Is there a concurrency structure (like a thread) in java which can execute runnables
Share
ThreadPoolExecutor, example here.
If, as Peter Lawrey suggested, you are after a reliable Runnable’s lifecycle manager then Java is not the right tool. If a thread (or a task in an executor) hangs the best recovery behavior is to have a watchdog thread that will commit process suicide with “restart me” exit code and have an external launcher (shell script, etc.) to restart the process which dies with “restart me” exit code.