Serializable, Wrapper, Referenceable, ObjectFactory, CommonDataSource, DataSource, OracleCommonDataSource, OracleDataSource, oracle.jdbc.replay.internal.OracleDataSource, OracleDataSourceOracleConnectionPoolDataSourceImplpublic class OracleDataSourceImpl extends Object implements oracle.jdbc.replay.internal.OracleDataSource, Serializable, Referenceable, ObjectFactory
CONNECTION_PROPERTIES, DATA_SOURCE_NAME, DATABASE_NAME, DESCRIPTION, EXPLICIT_CACHING_ENABLED, IMPLICIT_CACHING_ENABLED, MAX_STATEMENTS, NETWORK_PROTOCOL, PASSWORD, PORT_NUMBER, ROLE_NAME, SERVER_NAME, URL, USER| Constructor | Description |
|---|---|
OracleDataSourceImpl() |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
cleanup() |
|
void |
clearDoneDumpOnMemoryPressure() |
|
void |
clearReplayStatistics() |
Clears replay statistics accumulated so far on all connection
created by this data source.
|
OracleConnectionBuilderImpl |
createConnectionBuilder() |
Creates a new OracleConnectionBuilder instance
|
protected Connection |
enableACAndProxifyIfNecessary(Connection conn,
OracleConnectionBuilderImpl connBuilder) |
|
protected void |
finalize() |
|
Connection |
getConnection() |
|
Connection |
getConnection(String username,
String passwd) |
Attempts to obtain a database connection with the specified
user and password.
|
protected Connection |
getConnection(OracleConnectionBuilderImpl connBldr) |
|
oracle.jdbc.replay.internal.ConnectionInitializationCallback |
getConnectionInitializationCallback() |
Obtains the registered connection initialization callback, if any.
|
Connection |
getConnectionNoProxy(OracleConnectionBuilderImpl connBuilder) |
|
Properties |
getConnectionProperties() |
Gets the connection properties that are set on this data source.
|
String |
getConnectionProperty(String propertyName) |
Gets the specified connection property that are set on
this data source.
|
String |
getDatabaseName() |
Gets the database name.
|
String |
getDataSourceName() |
Gets the data source name.
|
String |
getDescription() |
Gets the data source description.
|
boolean |
getExplicitCachingEnabled() |
Returns the current value of the explicitCachingEnabled property.
|
boolean |
getImplicitCachingEnabled() |
getImplicitCachingEnabled
Returns the current value of the implicitCachingEnabled property.
|
int |
getLoginTimeout() |
|
PrintWriter |
getLogWriter() |
|
int |
getMaxStatements() |
Returns the current value of the maxStatements property.
|
String |
getNetworkProtocol() |
Gets the datasource networkProtocol.
|
Object |
getObjectInstance(Object refObj,
Name name,
Context nameCtx,
Hashtable<?,?> env) |
|
Logger |
getParentLogger() |
|
int |
getPortNumber() |
Gets the database port number.
|
oracle.jdbc.proxy.ProxyFactory |
getProxyFactory() |
|
Reference |
getReference() |
|
ReplayStatistics |
getReplayStatistics() |
Obtains replay statistics accumulated so far.
|
String |
getReplayStatisticsString() |
|
int |
getRequestSizeLimit() |
|
String |
getRoleName() |
Gets the datasource role name.
|
String |
getServerName() |
Gets the database server name.
|
String |
getURL() |
Gets the URL for this datasource.
|
String |
getUser() |
Gets the user name for this datasource.
|
boolean |
isWrapperFor(Class<?> iface) |
Since this class is not a wrapper, just check to see if this implements the
requested interface.
|
void |
registerConnectionInitializationCallback(oracle.jdbc.replay.internal.ConnectionInitializationCallback cbk) |
Registers a ConnectionInitializationCallback with the data source.
|
static void |
registerMBean() |
|
void |
removeReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics stats) |
|
void |
setConnectionProperties(Properties connProperties) |
Sets the connection properties on the data source.
|
void |
setConnectionProperty(String name,
String value) |
Sets a connection property on the data source.
|
void |
setDatabaseName(String databaseName) |
Sets the database name.
|
void |
setDataSourceName(String dataSourceName) |
Sets the data source name.
|
void |
setDescription(String description) |
Sets the data source description.
|
void |
setExplicitCachingEnabled(boolean cache) |
Sets the value of the explicitCachingEnabled property, which
enables or disables the explicit cache.
|
void |
setImplicitCachingEnabled(boolean cache) |
Sets the value of the implicitCachingEnabled property, which
enables or disables the implicit statement cache.
|
void |
setLoginTimeout(int seconds) |
|
void |
setLogWriter(PrintWriter out) |
|
void |
setMaxStatements(int max) |
Specifies the value of the maxStatements property.
|
void |
setNetworkProtocol(String networkProtocol) |
Sets the datasource networkProtocol.
|
void |
setPassword(String passwd) |
Sets the password with which connections have to be obtained.
|
void |
setPortNumber(int portNumber) |
Sets the database port number.
|
void |
setRoleName(String roleName) |
Sets the datasource role name.
|
void |
setServerName(String serverName) |
Sets the database server name.
|
void |
setSSLContext(SSLContext sslContext) |
Specifies a
SSLContext to use as a factory for
SSLEngine objects that carry out the TLS
protocol. |
void |
setTokenSupplier(java.util.function.Supplier<? extends AccessToken> tokenSupplier) |
Sets a supplier function that generates an access token when creating a
connection with this
DataSource. |
protected void |
setupACSpecificProperties() |
|
void |
setURL(String url) |
Sets the URL from which connections have to be obtained.
|
void |
setUser(String username) |
Set the user name with which connections have to be obtained.
|
void |
unregisterConnectionInitializationCallback(oracle.jdbc.replay.internal.ConnectionInitializationCallback cbk) |
Removes the ConnectionInitializationCallback registered with the
data source, if any.
|
static void |
unregisterMBean() |
|
<T> T |
unwrap(Class<T> iface) |
Since this class is not a wrapper, just check to see if this implements the
requested interface.
|
void |
updateReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics newStats) |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateShardingKeyBuilderprotected OracleDataSource ods
protected OracleDataSource odsReconnectOnly
protected String user
protected oracle.jdbc.internal.OpaqueString password
protected Properties connectionProperties
protected Properties reconnectionProperties
protected AtomicBoolean isFirstConnection
protected static final String RECONNECT_DELAY_PROPERTY
protected static final String RECONNECT_RETRIES_PROPERTY
protected int reconnectDelay
protected int reconnectRetries
protected static final String FAILOVER_TYPE_PROPERTY
protected static final int FAILOVER_TYPE_TRANSACTION
protected static final int SESSION_STATE_CONSISTENCY_STATIC
protected static final int FAILOVER_TYPE_AUTO
protected boolean isTransactionReplayEnabled
protected boolean isAutoACEnabled
protected static final String SESSION_STATE_PROPERTY
protected boolean isReplayInDynamicMode
protected static final String FAILOVER_RESTORE_PROPERTY
protected static final int FAILOVER_RESTORE_NONE
protected static final int FAILOVER_RESTORE_LEVEL1
protected static final int FAILOVER_RESTORE_AUTO
protected oracle.jdbc.replay.internal.ReplayableConnection.StateRestorationType stateRestorationType
protected boolean isStateRestorationAuto
protected static final String INITIATION_TIMEOUT_PROPERTY
protected int replayInitiationTimeout
protected static final String CHECKSUM_PROPERTY
protected final String clientChecksum12x
protected final String clientChecksum11203x
protected static final String IGNORE_AC_CONTEXT_PROPERTY
protected static final String REQUEST_SIZE_LIMIT_PROPERTY
protected AtomicBoolean doneDumpOnMemoryPressure
public Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic Connection getConnection(String username, String passwd) throws SQLException
getConnection in interface DataSourceusername - The database user on whose behalf the connection is
being made.passwd - The user's password.SQLException - if a database-access error occurs.protected Connection getConnection(OracleConnectionBuilderImpl connBldr) throws SQLException
SQLExceptionpublic Connection getConnectionNoProxy(OracleConnectionBuilderImpl connBuilder) throws SQLException
getConnectionNoProxy in interface oracle.jdbc.replay.internal.OracleDataSourceSQLExceptionprotected void setupACSpecificProperties()
throws SQLException
SQLExceptionprotected Connection enableACAndProxifyIfNecessary(Connection conn, OracleConnectionBuilderImpl connBuilder) throws SQLException
SQLExceptionpublic PrintWriter getLogWriter() throws SQLException
getLogWriter in interface CommonDataSourcegetLogWriter in interface DataSourceSQLExceptionpublic void setLogWriter(PrintWriter out) throws SQLException
setLogWriter in interface CommonDataSourcesetLogWriter in interface DataSourceSQLExceptionpublic void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface CommonDataSourcesetLoginTimeout in interface DataSourceSQLExceptionpublic int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourcegetLoginTimeout in interface DataSourceSQLExceptionpublic String getUser()
OracleCommonDataSourcegetUser in interface OracleCommonDataSourcepublic void setUser(String username) throws SQLException
OracleCommonDataSourcesetUser in interface OracleCommonDataSourceSQLExceptionpublic void setPassword(String passwd) throws SQLException
OracleCommonDataSourcesetPassword in interface OracleCommonDataSourcepasswd - Passowrd to be set.SQLExceptionpublic String getURL()
OracleCommonDataSourcegetURL in interface OracleCommonDataSourcepublic void setURL(String url) throws SQLException
OracleCommonDataSourcesetURL in interface OracleCommonDataSourceurl - URL to be set.SQLExceptionpublic void setServerName(String serverName) throws SQLException
setServerName in interface OracleCommonDataSourceserverName - Database server name to be set.SQLExceptionpublic String getServerName()
getServerName in interface OracleCommonDataSourcepublic void setPortNumber(int portNumber)
throws SQLException
setPortNumber in interface OracleCommonDataSourceportNumber - Database port number to be set.SQLExceptionpublic int getPortNumber()
getPortNumber in interface OracleCommonDataSourcepublic void setDatabaseName(String databaseName) throws SQLException
setDatabaseName in interface OracleCommonDataSourcedatabaseName - Database name to be set.SQLExceptionpublic String getDatabaseName()
getDatabaseName in interface OracleCommonDataSourcepublic void setDataSourceName(String dataSourceName) throws SQLException
setDataSourceName in interface OracleCommonDataSourcedataSourceName - data source name to be set.SQLExceptionpublic String getDataSourceName()
getDataSourceName in interface OracleCommonDataSourcepublic void setDescription(String description) throws SQLException
setDescription in interface OracleCommonDataSourcedescription - data source description to be set.SQLExceptionpublic String getDescription()
getDescription in interface OracleCommonDataSourcepublic void setNetworkProtocol(String networkProtocol) throws SQLException
setNetworkProtocol in interface OracleCommonDataSourcenetworkProtocol - datasource networkProtocol to be set.SQLExceptionpublic String getNetworkProtocol()
getNetworkProtocol in interface OracleCommonDataSourcepublic void setRoleName(String roleName) throws SQLException
setRoleName in interface OracleCommonDataSourcesetRoleName in interface OracleDataSourceroleName - datasource role name to be set.SQLExceptionpublic String getRoleName()
getRoleName in interface OracleCommonDataSourcegetRoleName in interface OracleDataSourcepublic void registerConnectionInitializationCallback(oracle.jdbc.replay.internal.ConnectionInitializationCallback cbk)
throws SQLException
registerConnectionInitializationCallback in interface OracleDataSourcecbk - The ConnectionInitializationCallback to be registered.SQLException - If the argument is null or callback
registration fails.public void unregisterConnectionInitializationCallback(oracle.jdbc.replay.internal.ConnectionInitializationCallback cbk)
throws SQLException
unregisterConnectionInitializationCallback in interface OracleDataSourcecbk - The ConnectionInitializationCallback
object to be unregistered.SQLException - If callback removal fails.public oracle.jdbc.replay.internal.ConnectionInitializationCallback getConnectionInitializationCallback()
OracleDataSourcegetConnectionInitializationCallback in interface OracleDataSourceConnectionInitializationCallback,
or null if there is no callback registered.public Properties getConnectionProperties()
getConnectionProperties in interface OracleCommonDataSourcepublic String getConnectionProperty(String propertyName)
getConnectionProperty in interface OracleDataSourcepropertyName - The name of the specified property.public void setConnectionProperty(String name, String value) throws SQLException
setConnectionProperty in interface OracleDataSourcename - The name of the connection property to be set.value - The value of the connection property to be set.SQLException - If any exception occurred while setting the connection
property.setConnectionProperties(java.util.Properties)public void setConnectionProperties(Properties connProperties) throws SQLException
setConnectionProperties in interface OracleCommonDataSourceconnectionProperties - Connection properties to be set.SQLException - If any exception occurred while setting the connection
properties.OracleConnectionpublic void setMaxStatements(int max)
throws SQLException
setMaxStatements in interface OracleCommonDataSourcesetMaxStatements in interface OracleDataSourcemax - Requested size of the cache. If the existing cache size
is less than max, statements will be purged to reduce the
size.SQLException - if max < 0public int getMaxStatements()
throws SQLException
getMaxStatements in interface OracleCommonDataSourcegetMaxStatements in interface OracleDataSourceSQLExceptionpublic void setImplicitCachingEnabled(boolean cache)
throws SQLException
setImplicitCachingEnabled in interface OracleCommonDataSourcesetImplicitCachingEnabled in interface OracleDataSourcecache - If true, then implicit caching is enabled. If false,
then any existing statement is purged and the implicit
caching is disabled.SQLExceptionpublic boolean getImplicitCachingEnabled()
throws SQLException
getImplicitCachingEnabled in interface OracleCommonDataSourcegetImplicitCachingEnabled in interface OracleDataSourceSQLExceptionpublic void setExplicitCachingEnabled(boolean cache)
throws SQLException
setExplicitCachingEnabled in interface OracleCommonDataSourcesetExplicitCachingEnabled in interface OracleDataSourcecache - If true, then explicit caching is enabled. If false,
then any existing statement is purged and the explicit
caching is disabled.SQLException - if called on a logical connection.public boolean getExplicitCachingEnabled()
throws SQLException
getExplicitCachingEnabled in interface OracleCommonDataSourcegetExplicitCachingEnabled in interface OracleDataSourceSQLExceptionpublic ReplayStatistics getReplayStatistics()
OracleDataSourcegetReplayStatistics in interface OracleDataSourcepublic void clearDoneDumpOnMemoryPressure()
clearDoneDumpOnMemoryPressure in interface oracle.jdbc.replay.internal.OracleDataSourcepublic String getReplayStatisticsString()
getReplayStatisticsString in interface oracle.jdbc.replay.internal.OracleDataSourcepublic void clearReplayStatistics()
OracleDataSourceclearReplayStatistics in interface OracleDataSourcepublic Reference getReference() throws NamingException
getReference in interface ReferenceableNamingExceptionpublic Object getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable<?,?> env) throws Exception
getObjectInstance in interface ObjectFactoryExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface Wrapperiface - Requested interface.SQLException - If the argument is not an interface.public <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface Wrapperiface - Requested interface.SQLException - If this does not implement the arg or the arg is not an interface.public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionpublic void updateReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics newStats)
updateReplayStatistics in interface oracle.jdbc.replay.internal.OracleDataSourcepublic void removeReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics stats)
removeReplayStatistics in interface oracle.jdbc.replay.internal.OracleDataSourcepublic int getRequestSizeLimit()
throws SQLException
getRequestSizeLimit in interface oracle.jdbc.replay.internal.OracleDataSourceSQLExceptionpublic oracle.jdbc.proxy.ProxyFactory getProxyFactory()
throws SQLException
getProxyFactory in interface oracle.jdbc.replay.internal.OracleDataSourceSQLExceptionpublic OracleConnectionBuilderImpl createConnectionBuilder()
createConnectionBuilder in interface DataSourcecreateConnectionBuilder in interface OracleDataSourcepublic final void setSSLContext(SSLContext sslContext)
OracleCommonDataSourceSSLContext to use as a factory for
SSLEngine objects that carry out the TLS
protocol.
The SSLContext must be initialized before establishing a connection to the data source. The certificates specified by that initialization will be used in place of any connection properties that would otherwise have specified certificates, such as key store and trust store property values.
Specifying a null value will clear any non-null value that may have been set previously, causing this data source to behave as if this method had never been called at all.
setSSLContext in interface OracleCommonDataSourcesslContext - An SSLContext to use as an SSLEngine factory.public final void setTokenSupplier(java.util.function.Supplier<? extends AccessToken> tokenSupplier)
OracleCommonDataSource
Sets a supplier function that generates an access token when creating a
connection with this DataSource. The supplier function
is invoked each time this DataSource creates a
connection. Instances of AccessToken that are output by the
supplier must represent a token type that is supported by Oracle Database
for client authentication. The supplier must be thread safe.
It is invalid to configure this DataSource with both a token
supplier and with a user name or password. If invocations of
OracleCommonDataSource.setUser(String), OracleCommonDataSource.setPassword(String),
OracleCommonDataSource.setConnectionProperties(java.util.Properties), or
#setConnectionProperty(String, String) have configured this
DataSource with a user name or password, and an invocation of
this method has also configured a token supplier, then a
SQLException indicating an invalid configuration is thrown when
creating a connection with this datasource.
Note that AccessToken.createJsonWebTokenCache(Supplier) can be
called to create a thread safe Supplier that caches tokens from
a user defined Supplier.
setTokenSupplier in interface OracleCommonDataSourcetokenSupplier - Token supplying function. Not null.public static void registerMBean()
public static void unregisterMBean()
public static void cleanup()