Is it possible to use directly (explicitly) the thread pools managed by Glassfish (created at Thread Pools -> Configuration
). Are those thread pools are accessible via JNDI, or anyhow else?
Use case: monitoring / configuring thread pool executors, backed with the thread pools managed by the app server.
Have a look at the GlassFishWorkManagerTaskExecutor provided by SpringFramework.
GlassFishWorkManagerTaskExecutor taskExecutor = new GlassFishWorkManagerTaskExecutor();
taskExecutor.setThreadPoolName("test_threadpool");
Runnable task = new Runnable() {
public void run() {
// do the task
}
}
taskExecutor.execute(task);