5

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.

Tiny
  • 27,221
  • 105
  • 339
  • 599
user120513
  • 531
  • 4
  • 12

1 Answers1

2

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
Eng.Fouad
  • 115,165
  • 71
  • 313
  • 417
  • 1
    Well, seems to be a poor concept that reminds somewhat to the old days of J2EE. But thanks for your disillutioning answer. (I'll upvote it, as far as I have the required 15 reps). – user120513 Apr 15 '15 at 08:29