Currently only one background job will run at a time, with other jobs queued, but given the configuration and comments I'm guessing that this wasn't intended.
Using an unbounded queue means that the thread pool won't grow beyond the specified core size. From the javadoc for ThreadPoolExecutor: "If there are more than corePoolSize but less than maximumPoolSize threads running, a new thread will be created only if the queue is full".
Switching to SynchronousQueue (as used by Executors.newCachedThreadPool) means that there's no queueing and gives the behaviour of growing the thread pool up to the maximum, shrinking based on the keep alive timeout, and throws RejectedExecutionException if the maximum is reached.
Currently only one background job will run at a time, with other jobs queued, but given the configuration and comments I'm guessing that this wasn't intended.
Using an unbounded queue means that the thread pool won't grow beyond the specified core size. From the javadoc for ThreadPoolExecutor: "If there are more than corePoolSize but less than maximumPoolSize threads running, a new thread will be created only if the queue is full".
Switching to SynchronousQueue (as used by Executors.newCachedThreadPool) means that there's no queueing and gives the behaviour of growing the thread pool up to the maximum, shrinking based on the keep alive timeout, and throws RejectedExecutionException if the maximum is reached.