public class JDBCUniversalPooledConnection
extends oracle.ucp.common.FailoverableUniversalPooledConnectionBase
| Modifier and Type | Field and Description |
|---|---|
static long |
CONNECTION_VALIDATION_TIMEOUT |
| Constructor and Description |
|---|
JDBCUniversalPooledConnection(JDBCConnectionPool connectionPool,
Object connection,
ConnectionRetrievalInfo connectionRetrievalInfo,
boolean connectionFailoverEnabled) |
| Modifier and Type | Method and 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.
|
void |
close()
TODO document
close connection
|
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 |
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.
|
oracle.ucp.common.CoreConnection |
getDelegator() |
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.
|
int |
getMaxStatements()
Gets the maximum number of statements that may be pooled or cached on a
Connection.
|
Object |
getPhysicalConnection()
Gets the connection.
|
String |
getService() |
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)
Obtains all the requested labels that did not match the applied
labels on this connection, when this connection was borrowed from
the pool.
|
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.
|
boolean |
isAvailable()
TODO document
|
boolean |
isConnectionHarvestable()
Whether this connection is currently harvestable.
|
boolean |
isReusable() |
boolean |
isSqlWithQueryTimeoutInProgress()
Checks whether or not the connection currently performing timed-out SQL operation
|
boolean |
isValid()
This method is called to check if the connection is valid or not.
|
boolean |
isValid(long timeout)
This method is called to check if the connection is valid or not.
|
int |
labelingCost(Properties labels)
Get a cost for labeling a connection up to a
required set of labels in the given CRI
This is unified method:
i.e.
|
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 |
setAvailable() |
void |
setAvailableStartTime()
Sets the time that this pooled connection became available.
|
void |
setBorrowed() |
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 |
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.
|
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.
|
public static final long CONNECTION_VALIDATION_TIMEOUT
public JDBCUniversalPooledConnection(JDBCConnectionPool connectionPool, Object connection, ConnectionRetrievalInfo connectionRetrievalInfo, boolean connectionFailoverEnabled) throws UniversalConnectionPoolException
UniversalConnectionPoolExceptionpublic void validate()
validate in interface UniversalPooledConnectionpublic boolean setShardingKeyIfValid(OracleShardingKey key, OracleShardingKey superKey, int timeout)
key - superKey - timeout - public Connection getSQLConnection(Object physicalConnection) throws SQLException
SQLExceptionprotected void initFailoverParameters()
throws UniversalConnectionPoolException
oracle.ucp.common.FailoverableUniversalPooledConnectionBaseinitFailoverParameters in class oracle.ucp.common.FailoverableUniversalPooledConnectionBaseUniversalConnectionPoolExceptionpublic int getMaxStatements()
public void setMaxStatements(int maxStatements)
throws SQLException
maxStatements - 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 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()
isValid in interface UniversalPooledConnectionpublic boolean isValid(long timeout)
throws SQLException
timeout - connection validation timeout in seconds.SQLExceptionpublic long getLastNetworkAccessTime()
getLastNetworkAccessTime in interface UniversalPooledConnectionpublic 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 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.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()
isReusable in interface UniversalPooledConnectionpublic void close()
UniversalPooledConnectionclose in interface Closeableclose in interface AutoCloseableclose in interface UniversalPooledConnectionpublic void abort()
UniversalPooledConnectionabort in interface UniversalPooledConnectionpublic void handleTimeout()
UniversalPooledConnectionhandleTimeout in interface UniversalPooledConnectionpublic boolean isAvailable()
UniversalPooledConnectionisAvailable in interface UniversalPooledConnectionpublic void setAvailable()
setAvailable in interface UniversalPooledConnectionpublic void setBorrowed()
setBorrowed in interface UniversalPooledConnectionpublic int labelingCost(Properties labels)
labelingCost in interface UniversalPooledConnectioncri - required CRI to label topublic void plugDelegator(oracle.ucp.common.CoreConnection delegator)
plugDelegator in interface UniversalPooledConnectionpublic oracle.ucp.common.CoreConnection getDelegator()
getDelegator in interface UniversalPooledConnectionpublic String getService()
Copyright © 2008, 2016, Oracle. All rights reserved.