EJB Thread Pool

The EJB Thread Pool is for prepared EJB beans which are ready for usage, this means there is no instantiation and initialization overhead when the bean is used. It can also be used to limit the number of concurrent beans in use.

An individual bean can specify a configuration that overrides the configuration of the EJB container in the <bean-pool> element of the glassfish-ejb-jar.xml file.

EJB Thread Pool Configuration Properties

The EJB Thread Pool has the following properties configured by default.

Setting Name Default Value Description

Core Pool Size

16

The minimum number of threads in the EJB container thread pool

Max Pool Size

32

The maximum number of threads in the EJB container thread pool

Keep Alive Seconds

60

The time, in seconds, which threads in excess of thread-core-pool-size are deleted

Queue Capacity

Integer.MAX_VALUE (2,147,483,647)

The size, in bytes, of the thread pool queue which stores new requests while new threads are created if more than thread-core-pool-size number of threads are running.

Allow Core Thread Timeout

false

All threads, including core threads, are subject to termination after thread-keep-alive-seconds

Prestart All Core Threads

false

Threads in the EJB container thread pool are started even if no requests have arrived, and the pool has a non-empty queue

Configuring the EJB Thread Pool

The EJB thread pool can be configured with either the admin console or the asadmin CLI, by making use of the following configuration properties.

Property Name Value Constraints

thread-core-pool-size

Cannot be less than 0, larger than max int, and must be larger than thread-max-pool-size

thread-max-pool-size

Cannot be less than 1 or greater than max int

thread-keep-alive-seconds

Cannot be less than 0 or greater than max int

thread-queue-capacity

Cannot be less than 1 or greater than max int

allow-core-thread-timeout

Must be true or false

prestart-all-core-threads

Must be true or false

Using the Admin Console

To configure the EJB thread pool using the admin console, go to Configuration → [instance-configuration] → EJB Container and scroll down to see Additional Properties.

Add a new additional property, set the Name to the property name from the table above of the property you want to set, and set the Value to a valid value for that property.

Admin Console Configuration

Using the Asadmin CLI

To configure the EJB thread pool with the asadmin CLI, execute the following set command, replacing the configName with the name of your configuration, the property name with a property name from the table above and a valid value for that property.

asadmin set configs.config.${configName}.ejb-container.property.${propertyName}=${propertyValue}