Custom pool configuration for your EJBs on JBoss AS 7/WildFly

Stateless session beans are held in a pool which can be configured at EJB Container level. You can define as many pool configuration as you want and then decide which one to use for your EJB container.

One thing which if often requested is to apply some specific settings for a particular EJB.

With JBoss AS 7 /EAP 6 and WildFly it is possible to apply some specific pool settings by decorating your class with the @org.jboss.ejb3.annotation.Pool annotation:

import org.jboss.ejb3.annotation.Pool;


public class  ServiceBean   {
. . .

 The value for the pool needs to be defined in your server configuration:

                    <strict-max-pool name="poolcustom" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>

 Please note that you can also define the Pool size using the jboss-ejb3.xml file as follows:

<jboss:ejb-jar xmlns:jboss="" xmlns=""
xmlns:xsi="" xmlns:p="urn:ejb-pool:1.0" xsi:schemaLocation="" version="3.1" impl-version="2.0">