Re: JOnAS/EasyBeans EJB Pool configurable?

Florent BENOIT <[email protected]> Wed, 09 Feb 2011 14:17:10 +0100
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
    Hi Hans,

Yes, pool is configurable with XML or annotations
Examples here : 
http://websvn.ow2.org/listing.php?repname=easybeans&path=%2Ftrunk%2Feasybeans%2Fexamples%2Fpool%2F

And the other good news is that you can try EJB 3.1 Singleton feature 
which is partially implemented in JOnAS 5.2 (but for your usage, that's 
should be ok)
Example here : 
http://websvn.ow2.org/listing.php?repname=easybeans&path=%2Ftrunk%2Feasybeans%2Fexamples%2Fsingleton%2F

Regards,

Florent

Hans J. Prueller wrote:
> Hi,
>
> yesterday I experimented with JOnAS 5 and @PostConstruct annotation at 
> SLSB's. As I found out, at initial access of my ear/webapp after 
> deployment and EJB lookup/invocation;
> the @PostContruct-annotated Method is invoked many times, not once as 
> I would have expected.
>
> Looking at JOnAS Admin web console, I saw that there are about "15 
> idle instances in the pool"  after initial access.
>
> As I did something very memory consuming  in the postconstruct-method 
> (loading a very large XML document) hich is saved as a member variable 
> of the SLSB),
> I reached OutOfMemoryExceptions very soon -- with 15 instances of this 
> SLSB in the pool, the XML config was also loaded 15 times into memory.
>
> One quick workaround was to make the config-xml member of the SLSB 
> "static" and only load it once for all instances, but this is a rather 
> dirty hack.
>
> Is there a way to configure  the EJB pool for SLSB's so that JOnAS / 
> EasyBeans do not automatically instantiate 15 instances but only 3 or 
> 5 or so ?
>
> Another solution would be EJB-singleton which holds the config XML, 
> but as this is part of Java EE 6 I guess this is not available at the 
> moment?
>
> regards,
> HANS
>