Hello, I am developing a custom JCA connector. In it, I have a matchManagedConnections method which discriminates by username. in pseudocode:
| public ManagedConnectionFactory { | Connection matchManagedConnections(Set set, ConnectionRequestInfo info) { | iterate (set) { | if (setItem.info.equals(info)) { | return setItem.conn; | } | } | return null; | } | | public ConnectionRequestInfo { | String username; | | boolean equals(other) { | return username.equals(other.username); | } | } | Creating a connection is very expensive in this connector (establishing a connection takes ~300-400ms). Connection pool management does not happen as I expected, maybe I should be doing something differently, but for e.g. this happens: * User A, B, C getConnection() (JBoss invokes createManagedConnection) and then the users close() their connection. * User B tries to getConnection() again. * JBoss calls matchManagedConnections passing a set with the singleton A user connection in the pool. matchManagedConnections returns null and the connection to A is destroyed. * JBoss calls matchManagedConnections passing a set with the singleton B user connection in the pool. matchManagedConnections returns the B connection. * User A tries to getConnection() again. * JBoss calls matchManagedConnections passing a set with the singleton C user connection in the pool. matchManagedConnections returns null and the connection to C is destroyed. * JBoss calls createManagedConnections for A because the pool is empty. * User C tries to getConnection() again. * JBoss calls createManagedConnections for C because the pool is empty. How can I avoid premature destruction of connections because of a bad connection match like this? Thank you for reading, -Vasco Alexandre da Silva Costa View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3936205#3936205 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3936205 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user