lundi 16 mars 2015

How to cancel a particular task by timeout when using ThreadPoolExecutor in Java?


Vote count:

0




I'm using ThreadPoolExecutor in Java to parallelize items processing. Each item processing is a separate task, that I put it in a queue for the executor to process. Unfortunately, some tasks can take too long and I want to be able to cancel such tasks and continue with the rest. I don't want to wait for shutdown method and its timeout (overall processing takes days). I want something like looping over currently executed tasks and checking for how long it is running and cancel it if it is above the limit.



asked just now







How to cancel a particular task by timeout when using ThreadPoolExecutor in Java?

Aucun commentaire:

Enregistrer un commentaire