I am using an API to connect to some hardware terminals and networks. The API allows me to connect to the servers, disconnect and interrogate for data, pretty similar to what JDBC connection allows you to do. Anyway, since this is not using the JDBC Connection interface, I cannot use a connection pooling already existing. I would like to avoid writing one myself if I can use one already existing, or maybe just build a small adapter on top of that. Anyone knows of any framework/library that would allow me to enable connection pooling, that can handle my connections, can ensure that the connection is alive all the time etc?
I have looked at Commons Pool, but that only gives you a few classes to put/get your connections ... it doesn't do any of the maintenance tasks etc (check if connection is invalid from time to time, reconnect etc). I can add on top of that the mechanism of connection checking and reconnecting if any issues etc in case there is nothing out there that does this already.
Cheers, Stef.
Apache Commons Pool actually supports creating, destroying and checking objects for validity before handing them out with the PoolableObjectFactory class, which you use with the actual pool implementation by passing it as a parameter:
final PoolableObjectFactory objectFactory = new MyPoolableObjectFactoryImpl();
final ObjectPool pool = new GenericObjectPool(objectFactory);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With