Package org.ujmp.jdbc.autoclose
Class AutoCloseConnection
java.lang.Object
org.ujmp.jdbc.autoclose.AutoCloseConnection
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Connection
static final int
static final int
private long
private final UJMPTimer
private final TimerTask
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
ConstructorsConstructorDescriptionAutoCloseConnection
(Connection c, int maxIdleTime) AutoCloseConnection
(Connection c, int maxIdleTime, long checkInterval) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
final void
final void
close()
final void
commit()
final Array
createArrayOf
(String typeName, Object[] elements) final Blob
final Clob
final NClob
final SQLXML
final Statement
final Statement
createStatement
(int resultSetType, int resultSetConcurrency) final Statement
createStatement
(int resultSetType, int resultSetConcurrency, int resultSetHoldability) final Struct
createStruct
(String typeName, Object[] attributes) boolean
final boolean
final String
final Properties
final String
getClientInfo
(String name) final int
final DatabaseMetaData
final int
final String
final int
final SQLWarning
int
hashCode()
final boolean
isClosed()
final boolean
final boolean
isValid
(int timeout) final boolean
isWrapperFor
(Class<?> iface) final String
final CallableStatement
prepareCall
(String sql) final CallableStatement
prepareCall
(String sql, int resultSetType, int resultSetConcurrency) final CallableStatement
prepareCall
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) final PreparedStatement
prepareStatement
(String sql) final PreparedStatement
prepareStatement
(String sql, int autoGeneratedKeys) final PreparedStatement
prepareStatement
(String sql, int[] columnIndexes) final PreparedStatement
prepareStatement
(String sql, int resultSetType, int resultSetConcurrency) final PreparedStatement
prepareStatement
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) final PreparedStatement
prepareStatement
(String sql, String[] columnNames) final void
releaseSavepoint
(Savepoint savepoint) final void
final void
rollback()
final void
final void
setAutoCommit
(boolean autoCommit) final void
setCatalog
(String catalog) final void
setClientInfo
(String name, String value) final void
setClientInfo
(Properties properties) final void
setHoldability
(int holdability) final void
setNetworkTimeout
(Executor executor, int milliseconds) final void
setReadOnly
(boolean readOnly) final Savepoint
final Savepoint
setSavepoint
(String name) final void
final void
setTransactionIsolation
(int level) final void
setTypeMap
(Map<String, Class<?>> map) toString()
final <T> T
-
Field Details
-
DEFAULTMAXIDLETIME
public static final int DEFAULTMAXIDLETIME- See Also:
-
DEFAULTCHECKINTERVAL
public static final int DEFAULTCHECKINTERVAL- See Also:
-
connection
-
timerTask
-
timer
-
lastAccessTime
private long lastAccessTime
-
-
Constructor Details
-
AutoCloseConnection
-
AutoCloseConnection
-
AutoCloseConnection
-
-
Method Details
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
resetTimer
public final void resetTimer() -
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
nativeSQL
- Specified by:
nativeSQL
in interfaceConnection
- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommit
in interfaceConnection
- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommit
in interfaceConnection
- Throws:
SQLException
-
commit
- Specified by:
commit
in interfaceConnection
- Throws:
SQLException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Throws:
SQLException
-
isClosed
- Specified by:
isClosed
in interfaceConnection
- Throws:
SQLException
-
getMetaData
- Specified by:
getMetaData
in interfaceConnection
- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnly
in interfaceConnection
- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnly
in interfaceConnection
- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalog
in interfaceConnection
- Throws:
SQLException
-
getCatalog
- Specified by:
getCatalog
in interfaceConnection
- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolation
in interfaceConnection
- Throws:
SQLException
-
getTransactionIsolation
- Specified by:
getTransactionIsolation
in interfaceConnection
- Throws:
SQLException
-
getWarnings
- Specified by:
getWarnings
in interfaceConnection
- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarnings
in interfaceConnection
- Throws:
SQLException
-
createStatement
public final Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareCall
public final CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
getTypeMap
- Specified by:
getTypeMap
in interfaceConnection
- Throws:
SQLException
-
setTypeMap
- Specified by:
setTypeMap
in interfaceConnection
- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldability
in interfaceConnection
- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldability
in interfaceConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
-
releaseSavepoint
- Specified by:
releaseSavepoint
in interfaceConnection
- Throws:
SQLException
-
createStatement
public final Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareCall
public final CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
createClob
- Specified by:
createClob
in interfaceConnection
- Throws:
SQLException
-
createBlob
- Specified by:
createBlob
in interfaceConnection
- Throws:
SQLException
-
createNClob
- Specified by:
createNClob
in interfaceConnection
- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXML
in interfaceConnection
- Throws:
SQLException
-
isValid
- Specified by:
isValid
in interfaceConnection
- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
createArrayOf
- Specified by:
createArrayOf
in interfaceConnection
- Throws:
SQLException
-
createStruct
- Specified by:
createStruct
in interfaceConnection
- Throws:
SQLException
-
setSchema
- Specified by:
setSchema
in interfaceConnection
- Throws:
SQLException
-
getSchema
- Specified by:
getSchema
in interfaceConnection
- Throws:
SQLException
-
abort
- Specified by:
abort
in interfaceConnection
- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
toString
-
equals
-
hashCode
public int hashCode()
-