Closeable, AutoCloseable, oracle.ucp.common.FailoverableUniversalPooledConnection, FailoverablePooledConnection, OracleFailoverablePooledConnection, UniversalPooledConnectionpublic class OracleUniversalPooledConnection extends JDBCUniversalPooledConnection implements OracleFailoverablePooledConnection, FailoverablePooledConnection
| Modifier and Type | Field | Description |
|---|---|---|
static int |
CANCELLATION_TIMEOUT |
|
protected Semaphore |
validitySemaphore |
| Constructor | Description |
|---|---|
OracleUniversalPooledConnection(JDBCConnectionPool connectionPool,
Object connection,
ConnectionRetrievalInfo connectionRetrievalInfo,
boolean connectionFailoverEnabled) |
Constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
abort() |
TODO document
abort connection
|
void |
applyConnectionLabel(String key,
String value) |
Connection labels can be applied on a borrowed connection by calling
this method at any time when the connection remains open.
|
boolean |
attachServerConnection(Properties requestedLabels) |
|
void |
close() |
TODO document
close connection
|
void |
close(boolean isConnectionBorrowed) |
Closes the underlying physical connection.
|
void |
detachServerConnection(String tag) |
|
protected Properties |
findUnmatchedTags(Properties requestedLabels) |
Compares the requested labels and DRCP return tag and returns the unmatched tags
|
AbandonedConnectionTimeoutCallback |
getAbandonedConnectionTimeoutCallback() |
Obtains the AbandonedConnectionTimeoutCallback registered with this
connection.
|
long |
getAvailableStartTime() |
Gets the time that this pooled connection became available.
|
long |
getBorrowedStartTime() |
Gets the timestamp that this pooled connection became borrowed.
|
ConnectionHarvestingCallback |
getConnectionHarvestingCallback() |
Obtains the ConnectionHarvestingCallback registered with this
connection.
|
Properties |
getConnectionInfo() |
|
Properties |
getConnectionLabels() |
Retrieves all the connection labels applied on this connection.
|
ConnectionRetrievalInfo |
getConnectionRetrievalInfo() |
Gets the connection retrieval info.
|
int |
getConnectionReuseCounter() |
Gets the connection reuse counter.
|
long |
getConnectionReuseTimestamp() |
Gets the connection reuse timestamp.
|
String |
getDatabase() |
|
Properties |
getDatabaseConnectionProperties() |
Fetches the connection properties.
|
int |
getDatabaseVersion() |
|
String |
getDataSourceInstanceName() |
Gets the data source instance name from which the physical connection
was retrieved.
|
String |
getDbUniqueName() |
Gets the database unique name from which the physical connection was
retrieved.
|
oracle.ucp.common.CoreConnection |
getDelegator() |
|
String |
getDRCPPLSQLCallbackName() |
Returns the PL/SQL Fix-up callback name if configured for the given connection,
otherwise returns
Null. |
String |
getDRCPReturnTag() |
Returns the tag associated with this DRCP pooled server.
|
protected String |
getDRCPTag(Properties labelProperties) |
Returns valid DRCP tag using the Label properties.
|
String |
getHost() |
|
String |
getHostName() |
Gets the host name from which the physical connection was retrieved.
|
String |
getInstance() |
Returns the RAC instance name that this connects to.
|
int |
getInstanceNumber() |
|
Date |
getInstanceStartTime() |
|
long |
getLastAccessedTime() |
Gets the last time, in milliseconds, that this pooled connection was
used by the client.
|
long |
getLastConnectionValidationTime() |
Gets the time that this pooled connection was last validated.
|
long |
getLastNetworkAccessTime() |
Gets the time (in milliseconds) when the underlying connection last
accessed the network.
|
Object |
getPhysicalConnection() |
Gets the connection.
|
oracle.ucp.jdbc.oracle.rlb.RLBInfo.Frame |
getRlbBorrowStats() |
|
String |
getService() |
|
String |
getServiceName() |
Gets the service name from which the physical connection was
retrieved.
|
boolean[] |
getShardingMode() |
|
Connection |
getSQLConnection(Object physicalConnection) |
|
UniversalPooledConnectionStatus |
getStatus() |
Gets the status of the pooled connection.
|
TimeToLiveConnectionTimeoutCallback |
getTimeToLiveConnectionTimeoutCallback() |
Obtains the TimeToLiveConnectionTimeoutCallback registered with this
connection.
|
Properties |
getUnmatchedConnectionLabels(Properties requestedLabels) |
This is overridden to handle DRCP tagging case.
|
void |
handleTimeout() |
TODO document
handle timeouts on connection
|
void |
heartbeat() |
This method is to be called to indicate that the pooled connection
is alive and being used.
|
protected void |
initFailoverParameters() |
Initializes the failover properties on this Universal Pooled Connection.
|
void |
initPdbSession(ConnectionRetrievalInfo cri) |
Initializes the connection with PDB specific settings if not already
initialized.
|
boolean |
isAvailable() |
check whether a connection is "available" or not
|
boolean |
isConnectionHarvestable() |
Whether this connection is currently harvestable.
|
boolean |
isDRCPEnabled() |
|
boolean |
isDRCPMultitagEnabled() |
Returns true if multiple tags are allowed with DRCP Connection.
|
boolean |
isMultitenantDatabase() |
|
boolean |
isNamedInstanceConnection() |
|
boolean |
isOracle() |
Is this connection an Oracle connection?
|
boolean |
isRacDataAffinityEnabled() |
Checks if the connection is to a Database with RAC Affinity Enabled
|
boolean |
isReusable() |
check whether a connection is "reusable" or not
|
boolean |
isSqlWithQueryTimeoutInProgress() |
Checks whether or not the connection currently performing timed-out SQL operation
|
boolean |
isValid(long timeout) |
This method is called to check if the connection is valid or not.
|
boolean |
isValid() |
This method is called to check if the connection is valid or not.
|
int |
labelingCost(Properties labels) |
If DRCP Multi-tag is enabled then this method skips
the cost calculation using labeling callback cost()
It compares the expected and current labels and return
0 incase of exact match, otherwise returns
Integer.MAX_VALUE value. |
void |
plugDelegator(oracle.ucp.common.CoreConnection delegator) |
|
void |
registerAbandonedConnectionTimeoutCallback(AbandonedConnectionTimeoutCallback cbk) |
Registers an AbandonedConnectionTimeoutCallback with this
connection.
|
void |
registerConnectionHarvestingCallback(ConnectionHarvestingCallback cbk) |
Registers a ConnectionHarvestingCallback with this connection.
|
void |
registerTimeToLiveConnectionTimeoutCallback(TimeToLiveConnectionTimeoutCallback cbk) |
Registers a TimeToLiveConnectionTimeoutCallback with this
connection.
|
void |
removeAbandonedConnectionTimeoutCallback() |
Removes the AbandonedConnectionTimeoutCallback object registered with
this connection, if any.
|
void |
removeConnectionHarvestingCallback() |
Removes the ConnectionHarvestingCallback object registered with this
connection, if any.
|
void |
removeConnectionLabel(String key) |
Removes the connection label with the given key from the connection
labels applied on this connection.
|
void |
removeTimeToLiveConnectionTimeoutCallback() |
Removes the TimeToLiveConnectionTimeoutCallback object registered
with this connection, if any.
|
void |
setAsNamedInstanceConnection() |
|
boolean |
setAvailable() |
mark connection as "available"
|
void |
setAvailableStartTime() |
Sets the time that this pooled connection became available.
|
boolean |
setBorrowed() |
mark connection as "borrowed"
|
void |
setBorrowedStartTime() |
Sets the time that this pooled connection became borrowed to be the
current system time.
|
void |
setConnectionHarvestable(boolean isConnectionHarvestable) |
Specifies whether this connection is harvestable.
|
void |
setConnectionRetrievalInfo(ConnectionRetrievalInfo newCri) |
Sets the connection retrieval info on the connection.
|
void |
setDataSourceInstanceName(String dataSourceInstanceName) |
Sets the data source instance name from which the physical connection
was retrieved.
|
void |
setDbUniqueName(String dbUniqueName) |
Sets the database unique name from which the physical connection was
retrieved.
|
void |
setHostName(String hostName) |
Sets the host name from which the physical connection was retrieved.
|
void |
setLastConnectionValidationTime(long lastConnectionValidationTime) |
Sets or resets the time when this pooled connection was last validated.
|
void |
setMaxStatements(int maxStatements) |
Sets the maximum number of statements that may be pooled or cached on
a connection.
|
void |
setPdbSessionInitialized(boolean initialized) |
For a multitenant database, when connected to PDB, checks if the PDB
session is initialized before the connection is checked out to the user.
|
void |
setRlbBorrowStats(oracle.ucp.jdbc.oracle.rlb.RLBInfo.Frame rlbStats) |
|
void |
setServiceName(String serviceName) |
Sets the service name from which the physical connection was
retrieved.
|
boolean |
setShardingKeyIfValid(OracleShardingKey key,
OracleShardingKey superKey,
int timeout) |
No implementation in base class, will be implemented in Oracle specific
connection class.
|
void |
setSqlWithQueryTimeoutInProgress(boolean sqlWithQueryTimeoutInProgress) |
Marks connection currently performing timed-out SQL operation
|
void |
setStatus(UniversalPooledConnectionStatus status) |
Sets the status of the pooled connection.
|
void |
setStatus(UniversalPooledConnectionStatus status,
String msg) |
|
void |
validate() |
Validates this connection and sets corresponding status on this
connection.
|
protected void |
validateDRCPKeyAndValue(String key,
String value) |
Checks if the Label key and value are valid.
|
getStatus, setStatusisFailoverEnabledisFailoverEnabledgetMaxStatementspublic static final int CANCELLATION_TIMEOUT
protected final Semaphore validitySemaphore
public OracleUniversalPooledConnection(JDBCConnectionPool connectionPool, Object connection, ConnectionRetrievalInfo connectionRetrievalInfo, boolean connectionFailoverEnabled) throws UniversalConnectionPoolException
connection - The connection.connectionRetrievalInfo - The connection retrieval info used
to create this connection.connectionFailoverEnabled - true if failover is enabled for
this pooled connection. false
otherwise.UniversalConnectionPoolException - if connection or connection retrieval info is null.public void validate()
validate in interface UniversalPooledConnectionvalidate in class JDBCUniversalPooledConnectionpublic boolean isValid()
isValid in interface UniversalPooledConnectionpublic long getLastNetworkAccessTime()
getLastNetworkAccessTime in interface UniversalPooledConnectionpublic boolean setShardingKeyIfValid(OracleShardingKey key, OracleShardingKey superKey, int timeout)
JDBCUniversalPooledConnectionsetShardingKeyIfValid in class JDBCUniversalPooledConnectionkey - sharding key to be set on the connectionsuperKey - super sharding key to be set on the connectiontimeout - timeout associated with the validation checkoracle.ucp.common.UniversalPooledConnectionImpl#isValid(oracle.jdbc.OracleShardingKey,
oracle.jdbc.OracleShardingKey, int)protected void initFailoverParameters()
throws UniversalConnectionPoolException
oracle.ucp.common.FailoverableUniversalPooledConnectionBaseinitFailoverParameters in class JDBCUniversalPooledConnectionUniversalConnectionPoolExceptionpublic int getInstanceNumber()
getInstanceNumber in interface FailoverablePooledConnectionpublic String getDataSourceInstanceName()
OracleFailoverablePooledConnectiongetDataSourceInstanceName in interface OracleFailoverablePooledConnectionnull.public void setDataSourceInstanceName(String dataSourceInstanceName)
OracleFailoverablePooledConnectionsetDataSourceInstanceName in interface OracleFailoverablePooledConnectionpublic String getDbUniqueName()
OracleFailoverablePooledConnectiongetDbUniqueName in interface OracleFailoverablePooledConnectionnull.public void setDbUniqueName(String dbUniqueName)
OracleFailoverablePooledConnectionsetDbUniqueName in interface OracleFailoverablePooledConnectionpublic String getHostName()
OracleFailoverablePooledConnectiongetHostName in interface OracleFailoverablePooledConnectionnull.public void setHostName(String hostName)
OracleFailoverablePooledConnectionsetHostName in interface OracleFailoverablePooledConnectionpublic String getServiceName()
OracleFailoverablePooledConnectiongetServiceName in interface OracleFailoverablePooledConnectionnull.public void setServiceName(String serviceName)
OracleFailoverablePooledConnectionsetServiceName in interface OracleFailoverablePooledConnectionpublic void setMaxStatements(int maxStatements)
throws SQLException
JDBCUniversalPooledConnectionsetMaxStatements in class JDBCUniversalPooledConnectionmaxStatements - maximum number of statements to be pooled.SQLException - Exception occurred during the process of setting
maximum statements that may be pooled on a connection.public void abort()
UniversalPooledConnectionabort in interface FailoverablePooledConnectionabort in interface UniversalPooledConnectionpublic void handleTimeout()
UniversalPooledConnectionhandleTimeout in interface UniversalPooledConnectionpublic Connection getSQLConnection(Object physicalConnection) throws SQLException
getSQLConnection in class JDBCUniversalPooledConnectionSQLExceptionpublic boolean setAvailable()
UniversalPooledConnectionsetAvailable in interface UniversalPooledConnectionpublic boolean attachServerConnection(Properties requestedLabels) throws SQLException
SQLExceptionpublic void detachServerConnection(String tag) throws SQLException
SQLExceptionprotected String getDRCPTag(Properties labelProperties) throws SQLException
key1=value1;key2=value2.. format.
If label value is NULL then the String "NULL" is used as default
DRCP tag value.labelProperties - SQLExceptionprotected void validateDRCPKeyAndValue(String key, String value) throws SQLException
= or ; character.
If any of the key or value is not valid then SQLException is thrown.key - value - SQLExceptionpublic boolean isDRCPEnabled()
throws SQLException
SQLExceptionpublic boolean isDRCPMultitagEnabled()
throws SQLException
SQLExceptionpublic String getDRCPReturnTag() throws UniversalConnectionPoolException
public String getDRCPPLSQLCallbackName() throws UniversalConnectionPoolException
Null.public Properties getUnmatchedConnectionLabels(Properties requestedLabels) throws UniversalConnectionPoolException
getUnmatchedConnectionLabels in interface UniversalPooledConnectionrequestedLabels - The requested labels that borrowed this
connection from the pool.UniversalConnectionPoolException - If this connection was
closed.protected Properties findUnmatchedTags(Properties requestedLabels) throws UniversalConnectionPoolException
requestedLabels - UniversalConnectionPoolExceptionpublic int getDatabaseVersion()
throws UniversalConnectionPoolException
getDatabaseVersion in interface FailoverablePooledConnectionUniversalConnectionPoolExceptionpublic boolean isNamedInstanceConnection()
isNamedInstanceConnection in interface FailoverablePooledConnectionpublic void setAsNamedInstanceConnection()
setAsNamedInstanceConnection in interface FailoverablePooledConnectionpublic String getInstance()
getInstance in interface FailoverablePooledConnectionpublic String getService()
getService in interface FailoverablePooledConnectionpublic String getHost()
getHost in interface FailoverablePooledConnectionpublic String getDatabase()
getDatabase in interface FailoverablePooledConnectionpublic void close(boolean isConnectionBorrowed)
throws UniversalConnectionPoolException
close in interface FailoverablePooledConnectionUniversalConnectionPoolExceptionpublic Date getInstanceStartTime()
getInstanceStartTime in interface FailoverablePooledConnectionpublic Properties getConnectionInfo() throws UniversalConnectionPoolException
getConnectionInfo in interface FailoverablePooledConnectionUniversalConnectionPoolExceptionpublic oracle.ucp.jdbc.oracle.rlb.RLBInfo.Frame getRlbBorrowStats()
public void setRlbBorrowStats(oracle.ucp.jdbc.oracle.rlb.RLBInfo.Frame rlbStats)
public boolean isMultitenantDatabase()
public boolean[] getShardingMode()
public boolean isRacDataAffinityEnabled()
public Properties getDatabaseConnectionProperties()
getDatabaseConnectionProperties in interface UniversalPooledConnectionpublic void setPdbSessionInitialized(boolean initialized)
initialized - false if connected to a Multitenant database and if the session
is not initialized, true otherwise.
(Internal API)public void initPdbSession(ConnectionRetrievalInfo cri) throws SQLException
SQLException - if there any exception during initializationpublic int labelingCost(Properties labels)
0 incase of exact match, otherwise returns
Integer.MAX_VALUE value.labelingCost in interface UniversalPooledConnectionpublic Object getPhysicalConnection()
getPhysicalConnection in interface UniversalPooledConnectionpublic ConnectionRetrievalInfo getConnectionRetrievalInfo()
getConnectionRetrievalInfo in interface UniversalPooledConnectionpublic void setConnectionRetrievalInfo(ConnectionRetrievalInfo newCri)
UniversalPooledConnectionsetConnectionRetrievalInfo in interface UniversalPooledConnectionnewCri - -new CRI to be used for this connectionpublic void heartbeat()
heartbeat in interface UniversalPooledConnectionpublic void setSqlWithQueryTimeoutInProgress(boolean sqlWithQueryTimeoutInProgress)
setSqlWithQueryTimeoutInProgress in interface UniversalPooledConnectionset - true if timed-out SQL operation is in progresspublic boolean isSqlWithQueryTimeoutInProgress()
isSqlWithQueryTimeoutInProgress in interface UniversalPooledConnectionpublic boolean isValid(long timeout)
throws SQLException
timeout - connection validation timeout in seconds.SQLExceptionpublic long getLastAccessedTime()
getLastAccessedTime in interface UniversalPooledConnectionpublic UniversalPooledConnectionStatus getStatus()
getStatus in interface UniversalPooledConnectionpublic void setStatus(UniversalPooledConnectionStatus status) throws UniversalConnectionPoolException
setStatus in interface UniversalPooledConnectionstatus - The status of the pooled connection.UniversalConnectionPoolException - if an error occurs setting the status.public void setStatus(UniversalPooledConnectionStatus status, String msg)
public long getAvailableStartTime()
getAvailableStartTime in interface UniversalPooledConnectionpublic void setAvailableStartTime()
setAvailableStartTime in interface UniversalPooledConnectionpublic long getBorrowedStartTime()
getBorrowedStartTime in interface UniversalPooledConnectionpublic void setBorrowedStartTime()
setBorrowedStartTime in interface UniversalPooledConnectionpublic long getLastConnectionValidationTime()
getLastConnectionValidationTime in interface UniversalPooledConnectionpublic void setLastConnectionValidationTime(long lastConnectionValidationTime)
setLastConnectionValidationTime in interface UniversalPooledConnectionpublic void applyConnectionLabel(String key, String value) throws UniversalConnectionPoolException
applyConnectionLabel in interface UniversalPooledConnectionkey - The key of the connection label to be applied. Cannot
be null or an empty string.value - The value of the connection label to be applied. Can be
null or an empty string.UniversalConnectionPoolException - If this connection was closed
or the key is null or an empty
string.public void removeConnectionLabel(String key) throws UniversalConnectionPoolException
removeConnectionLabel in interface UniversalPooledConnectionkey - The key of the connection label to be removed. Cannot be
null or an empty string.UniversalConnectionPoolException - If this connection was closed
or the key is null or an empty
string.public Properties getConnectionLabels() throws UniversalConnectionPoolException
getConnectionLabels in interface UniversalPooledConnectionUniversalConnectionPoolException - If this connection was
closed.public void setConnectionHarvestable(boolean isConnectionHarvestable)
throws UniversalConnectionPoolException
setConnectionHarvestable in interface UniversalPooledConnectionisConnectionHarvestable - Whether this connection is
harvestable.UniversalConnectionPoolException - If this connection was
closed.public boolean isConnectionHarvestable()
isConnectionHarvestable in interface UniversalPooledConnectionpublic void registerConnectionHarvestingCallback(ConnectionHarvestingCallback cbk) throws UniversalConnectionPoolException
registerConnectionHarvestingCallback in interface UniversalPooledConnectioncbk - The ConnectionHarvestingCallback object to be
registered.UniversalConnectionPoolException - If there is a callback already
registered with the connection.public void removeConnectionHarvestingCallback()
throws UniversalConnectionPoolException
removeConnectionHarvestingCallback in interface UniversalPooledConnectionUniversalConnectionPoolException - If callback removal fails.public ConnectionHarvestingCallback getConnectionHarvestingCallback() throws UniversalConnectionPoolException
getConnectionHarvestingCallback in interface UniversalPooledConnectionUniversalConnectionPoolException - If an error occurs.public void registerAbandonedConnectionTimeoutCallback(AbandonedConnectionTimeoutCallback cbk) throws UniversalConnectionPoolException
registerAbandonedConnectionTimeoutCallback in interface UniversalPooledConnectioncbk - The AbandonedConnectionTimeoutCallback object to be
registered.UniversalConnectionPoolException - If there is a callback already
registered with the connection.public void removeAbandonedConnectionTimeoutCallback()
throws UniversalConnectionPoolException
removeAbandonedConnectionTimeoutCallback in interface UniversalPooledConnectionUniversalConnectionPoolException - If callback removal fails.public AbandonedConnectionTimeoutCallback getAbandonedConnectionTimeoutCallback() throws UniversalConnectionPoolException
getAbandonedConnectionTimeoutCallback in interface UniversalPooledConnectionUniversalConnectionPoolException - If an error occurs.public void registerTimeToLiveConnectionTimeoutCallback(TimeToLiveConnectionTimeoutCallback cbk) throws UniversalConnectionPoolException
registerTimeToLiveConnectionTimeoutCallback in interface UniversalPooledConnectioncbk - The TimeToLiveConnectionTimeoutCallback object to be
registered.UniversalConnectionPoolException - If there is a callback already
registered with the connection.public void removeTimeToLiveConnectionTimeoutCallback()
throws UniversalConnectionPoolException
removeTimeToLiveConnectionTimeoutCallback in interface UniversalPooledConnectionUniversalConnectionPoolException - If callback removal fails.public TimeToLiveConnectionTimeoutCallback getTimeToLiveConnectionTimeoutCallback() throws UniversalConnectionPoolException
getTimeToLiveConnectionTimeoutCallback in interface UniversalPooledConnectionUniversalConnectionPoolException - If an error occurs.public int getConnectionReuseCounter()
public long getConnectionReuseTimestamp()
public boolean isReusable()
UniversalPooledConnectionisReusable in interface UniversalPooledConnectionpublic void close()
UniversalPooledConnectionclose in interface AutoCloseableclose in interface Closeableclose in interface UniversalPooledConnectionpublic boolean isAvailable()
UniversalPooledConnectionisAvailable in interface UniversalPooledConnectionpublic boolean setBorrowed()
UniversalPooledConnectionsetBorrowed in interface UniversalPooledConnectionpublic void plugDelegator(oracle.ucp.common.CoreConnection delegator)
plugDelegator in interface UniversalPooledConnectionpublic oracle.ucp.common.CoreConnection getDelegator()
getDelegator in interface UniversalPooledConnectionpublic boolean isOracle()
UniversalPooledConnectionisOracle in interface UniversalPooledConnection
Copyright © 2008, 2017, Oracle. All rights reserved.