Hello,
I try to implement my own JCA resource adapter, but face the problem connected to connection association.
My resource adapter should provide the possibility to connect to undefined number of EIS.
So I try to transfer connection settings in ConnectionSpec structure (instead of defining them in Connection Pool settings).
That resource adapter is used in Session Bean.
If session bean creates and uses just one connection everything works fine.
But if session bean in one method creates and tries to use two connections with different parameters, then second connection is associated with the same ManagedConnection as the first Connection (this is a problem).
This works this way:
- AS try to find any matched ManagedConnection in the pool, but my ManagedConnectionFactory.matchManagedConnections implementation always returns null, because connection settings are different.
- AS creates new ManagedConnection with new connection settings
- AS try to find any matched ManagedConnection in the pool and finds new one (matchManagedConnections returns it)
- AS calls ManagedConnection.associateConnection of first Managed Connection and associate new Connection with it (but it was created with different connection settings...)
- AS returns Connection to my session bean
- When my sesion bean closes connection, AS calls ManagedConnection.associateConnection of last Managed Connection and restores association of second Connection with correct Managed Connection.
Could anybody please help with this problem or just explain why this happens?
Is it possible to prevent connection reassociation in this case?
Thanks in advance,
Roman
[Message sent by forum member 'rpolozov' (rpolozov_at_gmail.com)]
http://forums.java.net/jive/thread.jspa?messageID=387791