I have a legacy system with simple telnet based command line interface.
I have already written JCA connection adapter for this system, and it works well.
Now I have got a legacy system expansion that adds ability to have several connection gateways, so I have task to change connection adapter behavior to make load sharing between several gateways.
Note then despite fact that there are several gateways exists, and correspondingly several connections do different IPs, all connections are equal from the applications point of view.
So I have decided to change ManagedConnectionFactory.createManagedConnection to force it to create connections sequentially to different gateways.
Moreover I had an idea that I can add functionality to ManagedConnectionFactory.matchManagedConnections to decide which connection to give from pool to application.
But I was wrong, because InternalManagedConnectionPool decide itself which ManagedConnection to return, and pass to matchManagedConnections method collection with only one connection to check if it is right. So I have possibility to control connections creation but unable to control connection allocation from pool.
It seems to me, that only way to add this functionality is to write my own ManagedConnectionPool with needed functionality, but I afraid that because I don?t clearly understand how it works, such replacement can lead to overall connector incorrect operation an will give me errors in production environment.
Can you give me any advice, how can I solve this problem with minimal costs?
Nobody never face with such problem ?