I am planning to create adjustable thread pool with adjustable queue size. I am using unbounded LinkedBlockingQueue with a external setting that controls how many messages are queued. Initially, my corepoolsize and maxpoolsize are equal. Now, if I want to update my threadpool size during runtime, I set corepoolsize and maxpoolsize through a common setting to a different value. I would like to know what do you think of this approach.
With maxpoolsize set to Integer.MAX_VALUE, can I just adjust corepoolsize as my queue is unbounded?
Is it a better idea to use SynchronousQueue with CallerRunsPolicy instead of LinkedBlockingQueue with external control?
IMPORTANT: I also want to know what happens when I decrease my corethreadpool size, will the tasks that are in progress gets abandoned in the middle?