multithreading - Controlling number of Threads for ManagedExecutorServices / Java EE 7 -
in java se 1 can use constructs
executorservice es1 = executors.newsinglethreadexecutor(); executorservice es2 = executors.newfixedthreadpool(10);
to control number of threads available executor service. in java ee 7 it's possible inject executor services:
@resource private managedexecutorservice mes;
but how can control number of threads available managed executor service ? example, in application i'm writing, there executor service has executed in single thread. can't let platform choose preferred number of threads.
actually, setting should set in server settings, through admin console (in glassfish example), or during creation of service:
asadmin create-managed-executor-service --corepoolsize=10 --maximumpoolsize=20 concurrent/mes
Comments
Post a Comment