This content has been marked as final.
Show 2 replies
-
1. Re: Bug in InternalManagedConnectionPool (permits)
jbossuser Jan 16, 2004 2:30 PM (in response to jbossuser)"jbossuser" wrote:
"jbossuser" wrote:
Never mind...found the logic. -
2. Re: Bug in InternalManagedConnectionPool (permits)
adrian.brock Jan 16, 2004 2:38 PM (in response to jbossuser)"adrian@jboss.org" wrote:
"adrian@jboss.org" wrote:
Reread the code.
It's basic format ispublic Connection getConnection() { if (permits.attempt()) { if (canMatchAConnectionInPool) return thatConnection; try { return createNewConnection(); } catch (Throwable t) { permits.release(); } } throw ResourceException; } public void returnConnection() { putConnectionBackInPool(); permits.release(); }
As you can see if there is no match in the pool, it creates a new connection.
If that fails, the permit is released and an error is thrown.
Once the connection is out of the pool, the only way to release the permit
is to return the connection to the pool.
Regards,
Adrian