I need to resize ThreadPoolExecutor task queue. Of course, BlockingQueue does not support resizing, and ThreadPoolExecutor does not support resizing.
So, the method I came up with is to use ThreadPoolExecutor.shutdownNow () , which returns me a list of Runnables that have not yet been executed. Then I can create a new artist with the desired queue size and resubmit all tasks.
The problem is related to the tasks being performed during the shutdownNow () call. As far as I can tell from javadoc, the executor will call Thread.interrupt () for all threads currently executing taks. I do not want my tasks to be killed. This question may have been a long way to ask, how do I write my tasks so that Thread.interrupt () has no effect?
source share