Java ExecutorService pause/resume a specific thread?

You are on the wrong track. The thread pool owns the threads and by sharing them with your code could mess things up. You should focus on making your tasks (passed to the threads cancellable/interruptable) and not interact with the threads owned by the pool directly.

Additionally you would not know what job is being executed at the time you try to interrupt the thread, so I can't see why you would be interested in doing this.

Suggestion: Similarly to/instead of the flags you're using, create a semaphore with 1 permit (new Semaphore(1)) for each task you need to pause/unpause. At the beginning of the task's working cycle put a code like this.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions