|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.config.DatabaseConnectionFactory.CachedConnection
This class is used to represent a cached database connection within this factory. The cached connection may or may not have been collected by the main java garbage collector thread. If the connection still exists and is not in use and does not have any errors then it may be reissued to another thread requestor.
Field Summary | |
private java.sql.Connection |
m_delegate
The cached connection |
private boolean |
m_hadError
This flag is set to true if the connection experienced an error. |
private boolean |
m_inUse
This flag is set to true if the connection is currently in use. |
private long |
m_lastUse
This value is used to mark the last time the connection was returned to the pool. |
private DatabaseConnectionFactory |
m_owner
The owner of the cached connection |
Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
(package private) |
DatabaseConnectionFactory.CachedConnection(java.sql.Connection dbc,
DatabaseConnectionFactory owner)
The class constructor used to create a new cached connection for a particular factory. |
Method Summary | |
(package private) long |
age()
Returns the current age of the connection since it was last used in milliseconds. |
private void |
checkAccess()
This method checks the access of the connection. |
void |
clearWarnings()
Forwards the request to the encapsulated connection after access to the connection is granted. |
void |
close()
Closes the SQL connection for the owner of the conneciton. |
void |
commit()
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.Statement |
createStatement()
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Forwards the request to the encapsulated connection after access to the connection is granted. |
boolean |
getAutoCommit()
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.lang.String |
getCatalog()
Forwards the request to the encapsulated connection after access to the connection is granted. |
int |
getHoldability()
|
java.sql.DatabaseMetaData |
getMetaData()
Forwards the request to the encapsulated connection after access to the connection is granted. |
int |
getTransactionIsolation()
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.util.Map |
getTypeMap()
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.SQLWarning |
getWarnings()
Forwards the request to the encapsulated connection after access to the connection is granted. |
(package private) boolean |
isAvailable()
Returns true if the cached connection is available for use. |
(package private) boolean |
isBad()
Returns true if the connection has experienced any errors. |
boolean |
isClosed()
Forwards the request to the encapuslated connection, or returns true if the connection is not in use. |
boolean |
isReadOnly()
Forwards the request to the encapsulated connection after access to the connection is granted. |
(package private) void |
markUsed()
Marks the connection as in use |
java.lang.String |
nativeSQL(java.lang.String sql)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
Forwards the request to the encapsulated connection after access to the connection is granted. |
void |
releaseSavepoint(java.sql.Savepoint savepoint)
|
void |
rollback()
Forwards the request to the encapsulated connection after access to the connection is granted. |
void |
rollback(java.sql.Savepoint savepoint)
|
void |
setAutoCommit(boolean autoCommit)
Forwards the request to the encapsulated connection after access to the connection is granted. |
void |
setCatalog(java.lang.String catalog)
Forwards the request to the encapsulated connection after access to the connection is granted. |
void |
setHoldability(int holdability)
|
void |
setReadOnly(boolean readOnly)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.sql.Savepoint |
setSavepoint()
|
java.sql.Savepoint |
setSavepoint(java.lang.String name)
|
void |
setTransactionIsolation(int level)
Forwards the request to the encapsulated connection after access to the connection is granted. |
void |
setTypeMap(java.util.Map map)
Forwards the request to the encapsulated connection after access to the connection is granted. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private final java.sql.Connection m_delegate
private final DatabaseConnectionFactory m_owner
private boolean m_inUse
private boolean m_hadError
private long m_lastUse
System.currentTimeMillis()
Constructor Detail |
DatabaseConnectionFactory.CachedConnection(java.sql.Connection dbc, DatabaseConnectionFactory owner)
dbc
- The database connection to cache.owner
- The owner of the cached connection.Method Detail |
private void checkAccess() throws java.sql.SQLException
java.sql.SQLException
- Thrown if access is denied.boolean isAvailable()
void markUsed()
boolean isBad()
long age()
public void close() throws java.sql.SQLException
close
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic boolean isClosed() throws java.sql.SQLException
isClosed
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.Statement createStatement() throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException
nativeSQL
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void setAutoCommit(boolean autoCommit) throws java.sql.SQLException
setAutoCommit
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic boolean getAutoCommit() throws java.sql.SQLException
getAutoCommit
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void commit() throws java.sql.SQLException
commit
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void rollback() throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void setReadOnly(boolean readOnly) throws java.sql.SQLException
setReadOnly
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic boolean isReadOnly() throws java.sql.SQLException
isReadOnly
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void setCatalog(java.lang.String catalog) throws java.sql.SQLException
setCatalog
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.lang.String getCatalog() throws java.sql.SQLException
getCatalog
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void setTransactionIsolation(int level) throws java.sql.SQLException
setTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic int getTransactionIsolation() throws java.sql.SQLException
getTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.SQLWarning getWarnings() throws java.sql.SQLException
getWarnings
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void clearWarnings() throws java.sql.SQLException
clearWarnings
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.util.Map getTypeMap() throws java.sql.SQLException
getTypeMap
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic void setTypeMap(java.util.Map map) throws java.sql.SQLException
setTypeMap
in interface java.sql.Connection
java.sql.SQLException
- May be thrown by the encapsulated connectionpublic java.lang.String toString()
public int getHoldability() throws java.sql.SQLException
getHoldability
in interface java.sql.Connection
java.sql.SQLException
public void setHoldability(int holdability) throws java.sql.SQLException
setHoldability
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLException
releaseSavepoint
in interface java.sql.Connection
java.sql.SQLException
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |