Search code examples
glassfishjmspoolmessage-driven-bean

How to restrict pool size of MDB on Glassfish v3


my Message Driven Bean executes highly intensive operations so I would like to restrict it's pool size or my server would have been overloaded. I have tried this ( code ) but it doesn't work, it's pool is still 32 ( empirically tested, time to time I restart a server so there are no pooled instances ).

@MessageDriven( mappedName = "jms/TestTopic", activationConfig = {
    @ActivationConfigProperty( propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge" ),
    @ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Topic" ),
    @ActivationConfigProperty( propertyName = "subscriptionDurability", propertyValue = "Durable" ),
    @ActivationConfigProperty( propertyName = "clientId", propertyValue = "Reader" ),
    @ActivationConfigProperty( propertyName = "subscriptionName", propertyValue = "Reader" ),
    @ActivationConfigProperty( propertyName = "endpointPoolMaxSize", propertyValue = "1" ),
    @ActivationConfigProperty( propertyName = "endpointPoolResizeCount", propertyValue = "1" ),
    @ActivationConfigProperty( propertyName = "endpointPoolSteadySize", propertyValue = "0" )
} )
public class Reader implements MessageListener {

I am using EJB 3 on Glassfish v3 on JDK 6. Application uses EE 6 standard.

Can you help me how to restrict the pool, please? Thanks for any help.


Solution

  • I would recommend creating a sun-ejb-jar.xml and put the pool configuration in there. See bean-pool in http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_1-0.dtd for the raw, gory details. See bean-pool in http://download.oracle.com/docs/cd/E19798-01/821-1750/6nmnbjlfi/index.html for the details, nicely polished.