ManagedExecutorService - max-threads configuration

412 views
Skip to first unread message

Heinz Marti

unread,
Jun 12, 2023, 10:51:53 AM6/12/23
to WildFly
In a JavaEE Application I have to spin up a lot of Threads. For that, I'm using the ManagedExecutorService.

@Resource
ManagedExecutorService mes;

In the standalone.xml configuration I have configured 25 core-threads and max-threads of 50. 
<managed-executor-service
 name="default"
 jndi-name="java:jboss/ee/concurrency/executor/default"
 context-service="default"
 hung-task-termination-period="0"
 hung-task-threshold="60000"
 keepalive-time="5000"
 core-threads="25"
 max-threads="50"
/>


My expectation is that 25 threads will process immediate the requests and other 25 are started and help processing the requests. But what I see is, that the requests are processed only on the "core-threads" base. 

what exactly is the meaning of this max-threads value?

regards

James Perkins

unread,
Jun 12, 2023, 11:01:03 AM6/12/23
to WildFly
In CLI you can get the description with /subsystem=ee/managed-executor-service=*:read-resource-description. You can also see it in the WildFly documenttion https://docs.wildfly.org/28/wildscribe/subsystem/ee/managed-executor-service/index.html.

That said, the documentation for max-threads states:
The maximum number of threads to be used by the executor. If left undefined the value from core-size will be used. This value is ignored if an unbounded queue is used (only core-threads will be used in that case).

Give you do not have a queue-length defined, you're using an unbounded queue. This means the value for max-threads is effectively ignored.

Reply all
Reply to author
Forward
0 new messages