In Java SE one can use constructs like
ExecutorService es1 = Executors.newSingleThreadExecutor();
ExecutorService es2 = Executors.newFixedThreadPool(10);
to control the number of threads available to the executor service. In Java EE 7 it's possible to inject executor services:
@Resource
private ManagedExecutorService mes;
But how can I control the number of threads available to the managed executor service ? For example, in the application I'm writing, there is an executor service that has to be executed in a single thread. So I can't just let the platform choose its preferred number of threads.
Actually, this setting should be set in the server settings, through admin console (in GlassFish for example), or during the creation of the service:
asadmin create-managed-executor-service --corepoolsize=10 --maximumpoolsize=20 concurrent/mes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With