Java ExecutorService pause/resume a specific thread

前端 未结 3 1355
独厮守ぢ
独厮守ぢ 2020-12-05 20:37

Is there a way to use ExecutorService to pause/resume a specific thread?

private static ExecutorService threadpool = Executors.newFixedThreadPool(5);
<         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 21:24

    One scenario could be, one wants to simulate a number of devices. Devices have functions. Altogether this collection of devices runs concurrently. And now if a thread represents a device ( or one thread for one function of a device ), one might want to control the life cycle of the device like start(), shutdown(), resume()

提交回复
热议问题