You need to implement ConnectionRequestInfo, and you need to implement the equals and hashCode methods so they distinguish between the contents rather than basing on the object identity. Otherwise the pools can't guess what mc's might be appropriate.
Thank you David it works great!
One more question, what is the reason for a ManagedConnectionFactory also implementing equals and hashCode?
Thank you David! It works great.
One other related question..
Why do ManagedConnectionFactory also implement equals and hashCode?
It's a spec requirement that I don't fully understand. I think it's because some app servers serialize mcfs and then need to find the original after deserialization. At the moment I can't remember if I succeeded in preventing jboss from ever needing to serialize an mcf. If you have a non-transient reference to the mcf in a ConnectionFactory (or DataSource) you can end up serializing it if an ejb gets passivated while holding a reference to the cf/ds.