Package oracle.ucp
Interface ConnectionFactoryAdapter
- All Superinterfaces:
Diagnosable
The connection factory adapter is responsible for creating and closing
connections for a specific resource (such as, JDBC or JCA). When a
connection is created, the connection factory adapter uses the
information in the connection retrieval info object to create a
connection. For example, if the resource is JDBC, the connection
retrieval info object contains a user and password that the
connection factory adapter uses to ask the JDBC resource for a
connection.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcloseConnection(Object connection) Closes the given connection.default CompletionStage<Void>closeConnectionAsync(Object connection, Executor executor) Closes a connection asynchronously.createConnection(ConnectionRetrievalInfo connectionRequestInfo) Creates a connection.default CompletionStage<Object>createConnectionAsync(ConnectionRetrievalInfo cri, Executor executor) Creates a connection asynchronously.createPooledConnection(Object connection, ConnectionRetrievalInfo connectionRequestInfo) Creates a UniversalPooledConnection object.default longget login timeout for this CFA.voidsetUniversalConnectionPool(UniversalConnectionPool connectionPool) Sets the connection pool that interacts with this connection factory adapter.Methods inherited from interface oracle.ucp.diagnostics.Diagnosable
beginCurrentSql, debug, debug, endCurrentSql, format, getDiagnosable, isLoggingLevelFinest, resumeLogging, secure, suspendLogging, trace, trace
-
Method Details
-
createConnection
Object createConnection(ConnectionRetrievalInfo connectionRequestInfo) throws UniversalConnectionPoolException Creates a connection.- Parameters:
connectionRequestInfo- The information to use to create the connection.- Returns:
- A connection.
nullif a connection could not be created. - Throws:
UniversalConnectionPoolException- if an error occurs while creating the connection.
-
closeConnection
Closes the given connection.- Parameters:
connection- The connection to close.- Throws:
UniversalConnectionPoolException- if an error occurs while closing the connection.
-
createConnectionAsync
default CompletionStage<Object> createConnectionAsync(ConnectionRetrievalInfo cri, Executor executor) Creates a connection asynchronously.- Parameters:
cri- The information to use to create the connection.executor- executor for asynchronous operation- Returns:
- completion stage for created connection (can return null or thrown exception)
-
closeConnectionAsync
Closes a connection asynchronously.- Parameters:
connection- Connection to close.executor- executor for asynchronous operation- Returns:
- completion stage for joining (or getting) an end of closure.
-
createPooledConnection
UniversalPooledConnection createPooledConnection(Object connection, ConnectionRetrievalInfo connectionRequestInfo) throws UniversalConnectionPoolException Creates a UniversalPooledConnection object.- Parameters:
connection- The physical connection that this pooled connection decorates.connectionRequestInfo- The connection retrieval info object used to create the decorated connection.- Returns:
- The
created UniversalPooledConnectionobject. - Throws:
UniversalConnectionPoolException- if an error occurs while creating theUniversalPooledConnectionobject.
-
setUniversalConnectionPool
void setUniversalConnectionPool(UniversalConnectionPool connectionPool) throws UniversalConnectionPoolException Sets the connection pool that interacts with this connection factory adapter.- Parameters:
connectionPool- The connection pool that interacts with this connection factory adapter. Cannot benull.- Throws:
UniversalConnectionPoolException- if the connection pool isnull.
-
getLoginTimeout
default long getLoginTimeout()get login timeout for this CFA.- Returns:
- login timeout (in milliseconds) for applicable connection factory adapters, or 0L.
-