开发者

How to use TimeToLiveConnectionTimeoutCallback in Oracle UCP

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 e开发者_如何学Goxpect 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜