I wanted to know whether there is a way for increasing number of threads in FixedThreadPool or ScheduledThreadPool when all the threads are in usage. That is for Example1: suppose we take a FixedThreadPool with size say 5, when all the threads are in usage then another task or function which need to be done has to wait for a thread to become free. I need to avoid this and the number of threads has to increase dynamically without using CachedThreadPool. Is there any way in doing so?
Example2:
ScheduledExecutorService execService = Executors.newScheduledThreadPool(1);
I have limited the number of threads in the above example 2 to 1. Now when this thread is busy in doing some task the other task to be done has to wait right? Now I want like : this fixed number of threads has to increase dynamically. Is there anyway in doing so?