Hi
I am trying to create an EJB which will always only have one actively executing instance, and which will have a steady-pool-size of zero, so that when idle there is absolutely no instances in the application server of my EJB.
The reason is that I am interfacing to a command line driven program, and this program allows only one online instance to execute the commands I need to execute.
My sun-ejb-jar.xml contains:
<ejb-name>CnrConfigEJB</ejb-name>
<bean-pool>
<steady-pool-size>0</steady-pool-size>
<resize-quantity>1</resize-quantity>
<max-pool-size>1</max-pool-size>
<pool-idle-timeout-in-seconds>30</pool-idle-timeout-in-seconds>
</bean-pool>
This works in a way in that an instance of the EJB is only created when there is actually a client calling the EJB, and after the client is done it lingers for 30 seconds waiting for more work, then it gets deleted (and the @Postdestruct method sends "quit" command to the command line application). Neat.
However, if I have more than one client thread calling the EJB service, glassfish --- regardless of the value of <max-pool-size> keeps creating instances of the EJB, one for each executing client thread. Still, once the threads terminate, glassfish deletes the EJB instances again --- execept one instance, which is allowed to linger for 30 seconds.
So it seems that glassfish <max-pool-size> only counts the number of idle EJB instances, not the number of executing EJB instances. Bug?
How can I implement an EJB that only ever has one active instance running?
Thanks for yout time,
Jacob
[Message sent by forum member 'jablo' ]
http://forums.java.net/jive/thread.jspa?messageID=373949