You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Etienne Vincelette <et...@pco-innovation.com> on 2013/04/16 10:23:33 UTC
Connections release
Hi,
I have some difficulty to release connection to a OpenEJB server. My client
application have a a manager that create the initial Context and retrieve a
Stateless bean. Before each call the the bean, the manager call a ping
method on this bean. If the ping doesn't respond we retrieve a new bean from
the pool. The bean is share between many thread. In heavy load tests, we
didn't had any problem for sharing the bean between threads. On production
server, we got error when the MaxSize connection is reached, event with
StrictPooling set to false. So we try to set MaxAge or IdleTimeout property
but connection aren't released. So we set the MaxSize to 0 to avoid blocking
situation.
There are my questions : Should I use one thread by bean? Is there a reason
why creating bean fail with StrinctSpooling set to false and MaxSize
reached?
Here is me connection verification method (client side):
private MyService cs;
synchronized private void connect()throws NamingException{
try{
cs.ping();
}
catch(Exception e){
cs = null;
}
if(cs == null){
setContext(); //create context if not accessible
Object ref = context.lookup("MyServer/MyService");
cs = (CryptoService)ref;
}
}
Here is my OpenEJB configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<openejb>
<Container id="My Singleton Container" type="SINGLETON">
AccessTimeout = 30 seconds
</Container>
<Container id="My Stateful Container" type="STATEFUL">
AccessTimeout = 30 seconds
Passivator org.apache.openejb.core.stateful.SimplePassivater
TimeOut 20
Frequency 60
Capacity 1000
BulkPassivate 100
</Container>
<Container id="My Stateless Container" type="STATELESS">
AccessTimeout = 30 seconds
MaxSize = 0
MinSize = 0
StrictPooling = false
MaxAge = 0 hours
IdleTimeout = 0 minutes
</Container>
<Resource id="My DataSource" type="DataSource">
JdbcDriver org.hsqldb.jdbcDriver
JdbcUrl jdbc:hsqldb:file:data/hsqldb/hsqldb
UserName sa
Password
JtaManaged true
</Resource>
<Resource id="My Unmanaged DataSource" type="DataSource">
JdbcDriver org.hsqldb.jdbcDriver
JdbcUrl jdbc:hsqldb:file:data/hsqldb/hsqldb
UserName sa
Password
JtaManaged false
</Resource>
<Deployments dir="apps/MyServer" />
</openejb>
--
View this message in context: http://openejb.979440.n4.nabble.com/Connections-release-tp4662294.html
Sent from the OpenEJB User mailing list archive at Nabble.com.