Question

How to use the TimeToLiveConnectionTimeoutCallback within Oracle UCP (Universal Connection Pool)?

I would expect that either the PoolDataSource or the UniversalConnectionPoolManager has an interface to register such a callback. And I would expect that such an interface would pass the concerned Connection by the interface. Neither is true.

It seems that I have to register an individual TimeToLiveConnectionTimeoutCallback to each UniversalPooledConnection which seems to me tricky, ugly (lots of UCP imports/glue code) and difficult (create a DataSource wrapper).

Or did I get something wrong? Unfortunately the documentation remains silent.

Was it helpful?

Solution

After some time passed, I realized that my assumption is true. I have to register a callback to each Connection in a tricky and unelegant way.

I also opened a support request from oracle which confirmed this:

void registerTimeToLiveConnectionTimeoutCallback(TimeToLiveConnectionTimeoutCallback cbk) throws java.sql.SQLException

registers a time-to-live connection timeout callback with a connection.

The callback object is registered with each pooled connection. It is an error to register more than 1 TimeToLiveConnectionTimeoutCallbacks on the same connection, or else you will get an exception.

As mentioned in it, the callback object is registered with EACH pooled connection.

Due to some other bugs and/or design flaws (of course, latter might be subjective) I decided to not UCP within my project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top