Package org.jboss.jca.adapters.jdbc
Class BaseWrapperManagedConnectionFactory
- java.lang.Object
-
- org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory
-
- All Implemented Interfaces:
Serializable,javax.resource.spi.ManagedConnectionFactory,javax.resource.spi.ResourceAdapterAssociation,javax.resource.spi.ValidatingManagedConnectionFactory,Statistics
- Direct Known Subclasses:
LocalManagedConnectionFactory,XAManagedConnectionFactory
public abstract class BaseWrapperManagedConnectionFactory extends Object implements javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ValidatingManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation, Statistics, Serializable
BaseWrapperManagedConnectionFactory- Author:
- David Jencks, Adrian Brock, Weston Price, Jesper Pedersen
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static AdaptersBundlebundleThe bundleprotected StringcheckValidConnectionSQLThe variablecheckValidConnectionSQLholds an sql statement that may be executed whenever a managed connection is removed from the pool, to check that it is still valid.protected ValidConnectionCheckerconnectionCheckerThe instance of the valid connection checkerprotected booleandoQueryTimeoutQuery timeout enabledprotected BooleanisTransactionQueryTimeoutTransaction query timeoutprotected AdaptersLoggerlogThe loggerprotected StringnewConnectionSQLThe variablenewConnectionSQLholds an SQL statement which if not null is executed when a new Connection is obtained for a new ManagedConnection.protected StringpasswordThe passwordprotected booleanpoolValidationLoggingEnabledprotected IntegerpreparedStatementCacheSizeThe prepared statement cache sizeprotected IntegerqueryTimeoutQuery timeoutprotected BooleansharePSWhether to share cached prepared statementsprotected StaleConnectionCheckerstaleConnectionCheckerThe instance of the stale connection checkerprotected PropertiesstaleConnectionCheckerPropsThe properties injected in the stale connection checkerstatic StringTRACK_STATEMENTS_FALSETrack statements - falsestatic intTRACK_STATEMENTS_FALSE_INTTrack statements - falsestatic StringTRACK_STATEMENTS_NOWARNTrack statements - no warningstatic intTRACK_STATEMENTS_NOWARN_INTTrack statements - no warningstatic StringTRACK_STATEMENTS_TRUETrack statements - truestatic intTRACK_STATEMENTS_TRUE_INTTrack statements - trueprotected inttrackStatementsTrack statementprotected inttransactionIsolationThe transaction isolation levelprotected StringurlDelimiterThe variableurlDelimiterholds the url delimiter information to be used for HA DS configuration .protected StringurlSelectorStrategyClassNameURL selector strategy class nameprotected StringuserNameThe user nameprotected StringvalidConnectionCheckerClassNameThe classname used to check whether a connection is validprotected PropertiesvalidConnectionCheckerPropsThe properties injected in the class used to check whether a connection is valid
-
Constructor Summary
Constructors Constructor Description BaseWrapperManagedConnectionFactory()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectcreateConnectionFactory()ObjectcreateConnectionFactory(javax.resource.spi.ConnectionManager cm)StringgetCheckValidConnectionSQL()Get the check valid connection SQL statementClassLoaderPlugingetClassLoaderPlugin()Get the clPlugin.StringgetConnectionListenerClassName()Get connection listener class nameStringgetConnectionListenerProperties()Get connection listener propertiesprotected PropertiesgetConnectionProperties(Properties connectionProps, Subject subject, javax.resource.spi.ConnectionRequestInfo cri)Gets full set of connection properties, i.e.ClassLoadergetExceptionSorterClassLoader()Get the exception sorter module nameStringgetExceptionSorterClassName()Get the exception sorter class nameStringgetExceptionSorterProperties()Get the exceptionSorterProperties.PropertiesgetExceptionSorterProps()Get the exceptionSorterProps.Set<BaseWrapperManagedConnection>getInvalidConnections(Set connectionSet)Get the invalid connectionsStringgetJndiName()Get the jndi name valuePrintWritergetLogWriter()StringgetNewConnectionSQL()Get the new connection SQL statementStringgetPassword()Get the passwordIntegergetPreparedStatementCacheSize()Get the prepared statement cache sizeIntegergetQueryTimeout()Get the query timeoutBooleangetReauthEnabled()Get reauth enabledStringgetReauthPluginClassName()Get reauth plugin class nameStringgetReauthPluginProperties()Get reauth plugin propertiesjavax.resource.spi.ResourceAdaptergetResourceAdapter()BooleangetSharePreparedStatements()Get the prepared statement share statusBooleangetSpy()Get the spy valueStringgetStaleConnectionCheckerClassName()Get the stale connection checker class nameStringgetStaleConnectionCheckerProperties()Get the staleConnectionCheckerProperties.PropertiesgetStaleConnectionCheckerProps()Get the staleConnectionCheckerProps.ClassLoadergetStaleConnectionClassLoader()Get the stale connection checker module nameJdbcStatisticsPlugingetStatistics()Get the statistics pluginStringgetTrackStatements()Get the track statement valueStringgetTransactionIsolation()Get the transaction isolation levelStringgetURLDelimiter()Get the url delimiterStringgetUrlSelectorStrategyClassName()Get the url selector strategy class nameStringgetUserName()Get the user nameIntegergetUseTryLock()Get the use try lock valueClassLoadergetValidConnectionCheckerClassLoader()Get the valid connection checker class loaderStringgetValidConnectionCheckerClassName()Get the valid connection checker class nameStringgetValidConnectionCheckerProperties()Get the validConnectionCheckerProperties.PropertiesgetValidConnectionCheckerProps()Get the validConnectionCheckerProps.booleanisDoLocking()Are we doing lockingbooleanisExceptionFatal(SQLException e)Is the exception fatalBooleanisJTA()Get the JTA statusBooleanisTransactionQueryTimeout()Is transaction query timeout setvoidsetCheckValidConnectionSQL(String checkValidConnectionSQL)Set the check valid connection SQL statementvoidsetClassLoaderPlugin(ClassLoaderPlugin clPlugin)Set the clPlugin.voidsetConnectionListenerClassName(String v)Set connection listener class namevoidsetConnectionListenerProperties(String v)Set connection listener propertiesvoidsetExceptionSorterClassLoader(ClassLoader exceptionSorterClassLoader)Set the exception sorter module namevoidsetExceptionSorterClassName(String exceptionSorterClassName)Set the exception sorter class namevoidsetExceptionSorterProperties(String exceptionSorterProperties)Set the exceptionSorterProperties.voidsetJndiName(String v)Set the jndi name valuevoidsetJTA(Boolean v)Set the JTA statusvoidsetLogWriter(PrintWriter v)voidsetNewConnectionSQL(String newConnectionSQL)Set the new connection SQL statementvoidsetOriginalTCCLn(ClassLoader cl)Set the originalTCCL.voidsetPassword(String password)Set the passwordvoidsetPoolValidationLoggingEnabled(boolean poolValidationLoggingEnabled)voidsetPreparedStatementCacheSize(Integer size)Set the prepared statement cache sizevoidsetQueryTimeout(Integer timeout)Set the query timeoutvoidsetReauthEnabled(Boolean v)Set reauth enabledvoidsetReauthPluginClassName(String v)Set reauth plugin class namevoidsetReauthPluginProperties(String v)Set reauth plugin propertiesvoidsetResourceAdapter(javax.resource.spi.ResourceAdapter ra)voidsetSharePreparedStatements(Boolean sharePS)Set the prepared statement share statusvoidsetSpy(Boolean v)Set the spy valuevoidsetStaleConnectionCheckerClassLoader(ClassLoader staleConnectionCheckerClassLoader)Set the stale connection checker module namevoidsetStaleConnectionCheckerClassName(String staleConnectionCheckerClassName)Set the stale connection checker class namevoidsetStaleConnectionCheckerProperties(String staleConnectionCheckerProperties)Set the staleConnectionCheckerProperties.voidsetTrackStatements(String value)Set the track statement valuevoidsetTransactionIsolation(String transactionIsolation)Set the transaction isolation levelvoidsetTransactionQueryTimeout(Boolean value)Set transaction query timeoutvoidsetURLDelimiter(String urlDelimiter)Set the url delimiter.voidsetUrlSelectorStrategyClassName(String urlSelectorStrategyClassName)Set the url selector strategy class namevoidsetUserName(String userName)Set the user namevoidsetUseTryLock(Integer useTryLock)Set the use try lock valuevoidsetValidConnectionCheckerClassLoader(ClassLoader validConnectionCheckerClassLoader)Set the valid connection checker class namevoidsetValidConnectionCheckerClassName(String validConnectionCheckerClassName)Set the valid connection checker class namevoidsetValidConnectionCheckerProperties(String validConnectionCheckerProperties)Set the validConnectionCheckerProperties.
-
-
-
Field Detail
-
TRACK_STATEMENTS_FALSE_INT
public static final int TRACK_STATEMENTS_FALSE_INT
Track statements - false- See Also:
- Constant Field Values
-
TRACK_STATEMENTS_TRUE_INT
public static final int TRACK_STATEMENTS_TRUE_INT
Track statements - true- See Also:
- Constant Field Values
-
TRACK_STATEMENTS_NOWARN_INT
public static final int TRACK_STATEMENTS_NOWARN_INT
Track statements - no warning- See Also:
- Constant Field Values
-
TRACK_STATEMENTS_FALSE
public static final String TRACK_STATEMENTS_FALSE
Track statements - false- See Also:
- Constant Field Values
-
TRACK_STATEMENTS_TRUE
public static final String TRACK_STATEMENTS_TRUE
Track statements - true- See Also:
- Constant Field Values
-
TRACK_STATEMENTS_NOWARN
public static final String TRACK_STATEMENTS_NOWARN
Track statements - no warning- See Also:
- Constant Field Values
-
log
protected final AdaptersLogger log
The logger
-
bundle
protected static AdaptersBundle bundle
The bundle
-
userName
protected String userName
The user name
-
password
protected String password
The password
-
transactionIsolation
protected int transactionIsolation
The transaction isolation level
-
preparedStatementCacheSize
protected Integer preparedStatementCacheSize
The prepared statement cache size
-
doQueryTimeout
protected boolean doQueryTimeout
Query timeout enabled
-
poolValidationLoggingEnabled
protected boolean poolValidationLoggingEnabled
-
newConnectionSQL
protected String newConnectionSQL
The variablenewConnectionSQLholds an SQL statement which if not null is executed when a new Connection is obtained for a new ManagedConnection.
-
checkValidConnectionSQL
protected String checkValidConnectionSQL
The variablecheckValidConnectionSQLholds an sql statement that may be executed whenever a managed connection is removed from the pool, to check that it is still valid. This requires setting up an mbean to execute it when notified by the ConnectionManager.
-
validConnectionCheckerClassName
protected String validConnectionCheckerClassName
The classname used to check whether a connection is valid
-
validConnectionCheckerProps
protected final Properties validConnectionCheckerProps
The properties injected in the class used to check whether a connection is valid
-
connectionChecker
protected ValidConnectionChecker connectionChecker
The instance of the valid connection checker
-
staleConnectionChecker
protected StaleConnectionChecker staleConnectionChecker
The instance of the stale connection checker
-
staleConnectionCheckerProps
protected final Properties staleConnectionCheckerProps
The properties injected in the stale connection checker
-
trackStatements
protected int trackStatements
Track statement
-
sharePS
protected Boolean sharePS
Whether to share cached prepared statements
-
isTransactionQueryTimeout
protected Boolean isTransactionQueryTimeout
Transaction query timeout
-
queryTimeout
protected Integer queryTimeout
Query timeout
-
urlDelimiter
protected String urlDelimiter
The variableurlDelimiterholds the url delimiter information to be used for HA DS configuration .
-
urlSelectorStrategyClassName
protected String urlSelectorStrategyClassName
URL selector strategy class name
-
-
Method Detail
-
getResourceAdapter
public javax.resource.spi.ResourceAdapter getResourceAdapter()
- Specified by:
getResourceAdapterin interfacejavax.resource.spi.ResourceAdapterAssociation
-
setResourceAdapter
public void setResourceAdapter(javax.resource.spi.ResourceAdapter ra)
- Specified by:
setResourceAdapterin interfacejavax.resource.spi.ResourceAdapterAssociation
-
getLogWriter
public PrintWriter getLogWriter() throws javax.resource.ResourceException
- Specified by:
getLogWriterin interfacejavax.resource.spi.ManagedConnectionFactory- Throws:
javax.resource.ResourceException
-
setLogWriter
public void setLogWriter(PrintWriter v) throws javax.resource.ResourceException
- Specified by:
setLogWriterin interfacejavax.resource.spi.ManagedConnectionFactory- Throws:
javax.resource.ResourceException
-
createConnectionFactory
public Object createConnectionFactory(javax.resource.spi.ConnectionManager cm) throws javax.resource.ResourceException
- Specified by:
createConnectionFactoryin interfacejavax.resource.spi.ManagedConnectionFactory- Throws:
javax.resource.ResourceException
-
createConnectionFactory
public Object createConnectionFactory() throws javax.resource.ResourceException
- Specified by:
createConnectionFactoryin interfacejavax.resource.spi.ManagedConnectionFactory- Throws:
javax.resource.ResourceException
-
getUserName
public String getUserName()
Get the user name- Returns:
- The value
-
setUserName
public void setUserName(String userName)
Set the user name- Parameters:
userName- The value
-
getPassword
public String getPassword()
Get the password- Returns:
- The value
-
setPassword
public void setPassword(String password)
Set the password- Parameters:
password- The value
-
getPreparedStatementCacheSize
public Integer getPreparedStatementCacheSize()
Get the prepared statement cache size- Returns:
- The value
-
setPreparedStatementCacheSize
public void setPreparedStatementCacheSize(Integer size)
Set the prepared statement cache size- Parameters:
size- The value
-
getSharePreparedStatements
public Boolean getSharePreparedStatements()
Get the prepared statement share status- Returns:
- The value
-
setSharePreparedStatements
public void setSharePreparedStatements(Boolean sharePS)
Set the prepared statement share status- Parameters:
sharePS- The value
-
getTransactionIsolation
public String getTransactionIsolation()
Get the transaction isolation level- Returns:
- The value
-
setTransactionIsolation
public void setTransactionIsolation(String transactionIsolation)
Set the transaction isolation level- Parameters:
transactionIsolation- The value
-
getNewConnectionSQL
public String getNewConnectionSQL()
Get the new connection SQL statement- Returns:
- The value
-
setNewConnectionSQL
public void setNewConnectionSQL(String newConnectionSQL)
Set the new connection SQL statement- Parameters:
newConnectionSQL- The value
-
getCheckValidConnectionSQL
public String getCheckValidConnectionSQL()
Get the check valid connection SQL statement- Returns:
- The value
-
setCheckValidConnectionSQL
public void setCheckValidConnectionSQL(String checkValidConnectionSQL)
Set the check valid connection SQL statement- Parameters:
checkValidConnectionSQL- The value
-
getStaleConnectionCheckerClassName
public String getStaleConnectionCheckerClassName()
Get the stale connection checker class name- Returns:
- The value
-
setStaleConnectionCheckerClassName
public void setStaleConnectionCheckerClassName(String staleConnectionCheckerClassName)
Set the stale connection checker class name- Parameters:
staleConnectionCheckerClassName- The staleConnectionCheckerClassName
-
getStaleConnectionClassLoader
public ClassLoader getStaleConnectionClassLoader()
Get the stale connection checker module name- Returns:
- The value
-
setStaleConnectionCheckerClassLoader
public void setStaleConnectionCheckerClassLoader(ClassLoader staleConnectionCheckerClassLoader)
Set the stale connection checker module name- Parameters:
staleConnectionCheckerClassLoader- The staleConnectionCheckerModuleName
-
getTrackStatements
public String getTrackStatements()
Get the track statement value- Returns:
- The value
-
setTrackStatements
public void setTrackStatements(String value)
Set the track statement value- Parameters:
value- The value
-
getExceptionSorterClassName
public String getExceptionSorterClassName()
Get the exception sorter class name- Returns:
- The value
-
setExceptionSorterClassName
public void setExceptionSorterClassName(String exceptionSorterClassName)
Set the exception sorter class name- Parameters:
exceptionSorterClassName- The value
-
getExceptionSorterClassLoader
public ClassLoader getExceptionSorterClassLoader()
Get the exception sorter module name- Returns:
- The value
-
setExceptionSorterClassLoader
public void setExceptionSorterClassLoader(ClassLoader exceptionSorterClassLoader)
Set the exception sorter module name- Parameters:
exceptionSorterClassLoader- The value
-
getValidConnectionCheckerClassName
public String getValidConnectionCheckerClassName()
Get the valid connection checker class name- Returns:
- The value
-
setValidConnectionCheckerClassName
public void setValidConnectionCheckerClassName(String validConnectionCheckerClassName)
Set the valid connection checker class name- Parameters:
validConnectionCheckerClassName- The value
-
getValidConnectionCheckerClassLoader
public ClassLoader getValidConnectionCheckerClassLoader()
Get the valid connection checker class loader- Returns:
- The value
-
setValidConnectionCheckerClassLoader
public void setValidConnectionCheckerClassLoader(ClassLoader validConnectionCheckerClassLoader)
Set the valid connection checker class name- Parameters:
validConnectionCheckerClassLoader- The value
-
isTransactionQueryTimeout
public Boolean isTransactionQueryTimeout()
Is transaction query timeout set- Returns:
- The value
-
setTransactionQueryTimeout
public void setTransactionQueryTimeout(Boolean value)
Set transaction query timeout- Parameters:
value- The value
-
getQueryTimeout
public Integer getQueryTimeout()
Get the query timeout- Returns:
- The value
-
setQueryTimeout
public void setQueryTimeout(Integer timeout)
Set the query timeout- Parameters:
timeout- The value
-
getUseTryLock
public Integer getUseTryLock()
Get the use try lock value- Returns:
- The value
-
setUseTryLock
public void setUseTryLock(Integer useTryLock)
Set the use try lock value- Parameters:
useTryLock- The value
-
isDoLocking
public boolean isDoLocking()
Are we doing locking- Returns:
trueif locking, otherwisefalse
-
setSpy
public void setSpy(Boolean v)
Set the spy value- Parameters:
v- The value
-
getSpy
public Boolean getSpy()
Get the spy value- Returns:
- The value
-
setJndiName
public void setJndiName(String v)
Set the jndi name value- Parameters:
v- The value
-
getJndiName
public String getJndiName()
Get the jndi name value- Returns:
- The value
-
getReauthEnabled
public Boolean getReauthEnabled()
Get reauth enabled- Returns:
- The value
-
setReauthEnabled
public void setReauthEnabled(Boolean v)
Set reauth enabled- Parameters:
v- The value
-
getReauthPluginClassName
public String getReauthPluginClassName()
Get reauth plugin class name- Returns:
- The value
-
setReauthPluginClassName
public void setReauthPluginClassName(String v)
Set reauth plugin class name- Parameters:
v- The value
-
getReauthPluginProperties
public String getReauthPluginProperties()
Get reauth plugin properties- Returns:
- The value
-
setReauthPluginProperties
public void setReauthPluginProperties(String v)
Set reauth plugin properties- Parameters:
v- The value
-
getConnectionListenerClassName
public String getConnectionListenerClassName()
Get connection listener class name- Returns:
- The value
-
setConnectionListenerClassName
public void setConnectionListenerClassName(String v)
Set connection listener class name- Parameters:
v- The value
-
getConnectionListenerProperties
public String getConnectionListenerProperties()
Get connection listener properties- Returns:
- The value
-
setConnectionListenerProperties
public void setConnectionListenerProperties(String v)
Set connection listener properties- Parameters:
v- The value
-
getURLDelimiter
public String getURLDelimiter()
Get the url delimiter- Returns:
- The value
-
setURLDelimiter
public void setURLDelimiter(String urlDelimiter)
Set the url delimiter.- Parameters:
urlDelimiter- The value
-
getUrlSelectorStrategyClassName
public String getUrlSelectorStrategyClassName()
Get the url selector strategy class name- Returns:
- The value
-
setUrlSelectorStrategyClassName
public void setUrlSelectorStrategyClassName(String urlSelectorStrategyClassName)
Set the url selector strategy class name- Parameters:
urlSelectorStrategyClassName- The value
-
getStatistics
public JdbcStatisticsPlugin getStatistics()
Get the statistics plugin- Specified by:
getStatisticsin interfaceStatistics- Returns:
- The value
-
isJTA
public Boolean isJTA()
Get the JTA status- Returns:
- The value
-
setJTA
public void setJTA(Boolean v)
Set the JTA status- Parameters:
v- The value
-
getInvalidConnections
public Set<BaseWrapperManagedConnection> getInvalidConnections(Set connectionSet) throws javax.resource.ResourceException
Get the invalid connections- Specified by:
getInvalidConnectionsin interfacejavax.resource.spi.ValidatingManagedConnectionFactory- Parameters:
connectionSet- The connection set- Returns:
- The invalid connections
- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
getConnectionProperties
protected Properties getConnectionProperties(Properties connectionProps, Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException
Gets full set of connection properties, i.e. whatever is provided in config plus "user" and "password" from subject/cri.Note that the set is used to match connections to datasources as well as to create new managed connections.
In fact, we have a problem here. Theoretically, there is a possible name collision between config properties and "user"/"password".
- Parameters:
connectionProps- The connection propertiessubject- The subjectcri- The connection request info- Returns:
- The properties
- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
isExceptionFatal
public boolean isExceptionFatal(SQLException e)
Is the exception fatal- Parameters:
e- The exception- Returns:
- True if fatal; otherwise false
-
setPoolValidationLoggingEnabled
public void setPoolValidationLoggingEnabled(boolean poolValidationLoggingEnabled)
-
getValidConnectionCheckerProps
public final Properties getValidConnectionCheckerProps()
Get the validConnectionCheckerProps.- Returns:
- the validConnectionCheckerProps.
-
getStaleConnectionCheckerProps
public final Properties getStaleConnectionCheckerProps()
Get the staleConnectionCheckerProps.- Returns:
- the staleConnectionCheckerProps.
-
getExceptionSorterProps
public final Properties getExceptionSorterProps()
Get the exceptionSorterProps.- Returns:
- the exceptionSorterProps.
-
getValidConnectionCheckerProperties
public final String getValidConnectionCheckerProperties()
Get the validConnectionCheckerProperties.- Returns:
- the validConnectionCheckerProperties.
-
setValidConnectionCheckerProperties
public final void setValidConnectionCheckerProperties(String validConnectionCheckerProperties)
Set the validConnectionCheckerProperties.- Parameters:
validConnectionCheckerProperties- The validConnectionCheckerProperties to set.
-
getStaleConnectionCheckerProperties
public final String getStaleConnectionCheckerProperties()
Get the staleConnectionCheckerProperties.- Returns:
- the staleConnectionCheckerProperties.
-
setStaleConnectionCheckerProperties
public final void setStaleConnectionCheckerProperties(String staleConnectionCheckerProperties)
Set the staleConnectionCheckerProperties.- Parameters:
staleConnectionCheckerProperties- The staleConnectionCheckerProperties to set.
-
getExceptionSorterProperties
public final String getExceptionSorterProperties()
Get the exceptionSorterProperties.- Returns:
- the exceptionSorterProperties.
-
setExceptionSorterProperties
public final void setExceptionSorterProperties(String exceptionSorterProperties)
Set the exceptionSorterProperties.- Parameters:
exceptionSorterProperties- The exceptionSorterProperties to set.
-
getClassLoaderPlugin
public final ClassLoaderPlugin getClassLoaderPlugin()
Get the clPlugin.- Returns:
- the clPlugin.
-
setClassLoaderPlugin
public final void setClassLoaderPlugin(ClassLoaderPlugin clPlugin)
Set the clPlugin.- Parameters:
clPlugin- The clPlugin to set.
-
setOriginalTCCLn
public final void setOriginalTCCLn(ClassLoader cl)
Set the originalTCCL.- Parameters:
cl- The clPlugin to set.
-
-