Interface TimeToLiveConnectionTimeoutCallback
-
public interface TimeToLiveConnectionTimeoutCallbackThe callback interface for the time-to-live (TTL) connection timeout feature. This allows applications to provide customized handling for TTL timed-out connections. Also, see the related properties onUniversalConnectionPoolandPoolDataSource.The callback object is optionally registered with each pooled connection or using any of its logical connection proxies, allowing applications to perform customized handling when this particular connection has TTL timed-out.
The
handleTimedOutConnection(...)method is invoked when a borrowed connection is found to be TTL timed-out by the Universal Connection Pool. Applications can choose to completely override the pool's handling, invoke additional handling actions, or simply assume the pool's default handling. For example, JDBC applications can invokecancel(),close(), androllback()methods on the TTL timed-out connection within this method.It is an error to register more than one
TimeToLiveConnectionTimeoutCallbackson the same connection. Any such attempt will result in aUniversalConnectionPoolExceptionat the pool layer, or an exception specific to the type of a Universal Connection Pool Adapter (e.g., JDBC, JCA, and so forth) likejava.sql.SQLException.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanhandleTimedOutConnection()Returns whether or not and application handles TTL timeout connections.
-
-
-
Method Detail
-
handleTimedOutConnection
boolean handleTimedOutConnection()
Returns whether or not and application handles TTL timeout connections.This method is called by the connection pool on the connection that has TTL timed-out to allow applications to customize the TTL timed-out connection handling.
The method implementation must return
trueif the application handles thetimeToLiveConnectionTimeoutin place of the pool and must returnfalseif the application wants the pool to take over the TTL-timeout connection handling. In the former case, applications have the option of simply holding on to the borrowed connection or performing some actions and returning the timed-out connection to the pool. For the pool layer, this means callingreturnConnection(); while, for the pool adapter layer, this means callingclose()on the connection proxy.- Returns:
- If the application's customized handling overrides the pool's
actions, return
true; otherwise, returnfalse.
-
-