[jboss-user] [JCA/JBoss] - Re: Why is jboss closing my connection?
adrian@jboss.org
do-not-reply at jboss.com
Mon Jun 18 09:50:54 EDT 2007
"teknokrat" wrote : Ok, thanks. Is there a way to switch this off on a per connection factory level? I would like to get the benefits of the checking for database connections but not on my own session based connections.
|
As per the docs:
debug=false in jbossjca-service.xml
But then avoiding connection leakage becomes your problem. :-)
As stated many times in this forum. Holding one connection per ejb instance
is an anti-pattern and a totally inefficient use of resources.
The connections are already pooled (and cached at the transaction level)
by JCA which leads to a much more efficient use of resources.
| // CMT Required Transaction
| public void doSomething()
| {
| ConnectionFactory cf = ...
| Connection c1 = cf.getConnection(); // Handle
| Connection real2 = c.getRealConnection(); // Real
|
| Connection c2 = cf.getConnection(); // Handle
| Connection real2 = c.getRealConnection(); // Real
|
| assert c1 != c2; // Handles are not the same instance
| assert real1 == real2; // But you always use the same real/underlying connection in the same transaction
| }
|
"teknokrat" wrote :
| Also, just out of curiosity, what is the heuristic that jboss uses to decide that a connection has been checked out of the pool long enough and needs closing?
|
In a transaction - the end of the transaction
Otherwise the end of request (EJB method/Web invocation)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055235#4055235
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055235
More information about the jboss-user
mailing list