I am continually running out of database connections using a DataSource, Spring and Quartz. As seen below, my TaskExecutor's maximumPoolSize is 30. So, is that the maximum # of connections my setup will use?
With a corePoolSize = 10, is my setup holding 10 database connections continually?
I am using a Spring TaskExecutor which I create like this and register with my Spring SchedulerFactoryBean.
I create a TaskExecutor like this:
public TaskExecutor schedulerTaskExecutor() {
int corePoolSize = 10;
int maxPoolSize = 30;
long keepAliveTime = 30000;
int internalQueueCapacity = 1000;
boolean allowCoreThreadTimeOut = true;
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(
corePoolSize, // core pool size
maxPoolSize, // max pool size
keepAliveTime,
TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(internalQueueCapacity)) ;
threadPool.allowCoreThreadTimeOut(allowCoreThreadTimeOut);
NamedThreadFactory threadFactory = new NamedThreadFactory("SCHEDULER-");
threadPool.setThreadFactory(threadFactory);
return new TaskExecutorAdapter(threadPool);
}