Suppose there is a message-driven bean (MDB) on the Java application server. The MDB receives the message from the JMS queue and passes it to the message processor. In my case, the message processor is an extremely heavy weight object that requires extensive initialization, so I do not want to create a new one to process each message. Instead, I would like to create a pool of message handlers ahead of time and use them to process messages.
So my question is: what is the “right” way to create this pool on a J2EE application server? Does any server have built-in support for defining custom (unrelated) object pools? I would like to use any built-in support for this template before I just insert the pool into a singleton and hope for the best. In particular:
- How to define / create an instance of a pool?
- How do I access the pool? JNDI?
- What management features are provided by the application server?
I know how to implement a pool of objects in general. My question is mainly related to creating a pool on a J2EE application server.
I plan on using Glassfish, but I'm flexible if JBoss or something else makes this easier.
Thanks!