Package com.alibaba.druid.pool
Class DruidPooledConnection
java.lang.Object
com.alibaba.druid.pool.PoolableWrapper
com.alibaba.druid.pool.DruidPooledConnection
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
,PooledConnection
- Author:
- wenshao [[email protected]]
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected int
protected Connection
protected StackTraceElement[]
protected boolean
protected Throwable
protected FilterChain
protected DruidConnectionHolder
static final int
protected final Thread
protected boolean
protected TransactionInfo
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
abandond()
void
void
void
void
void
void
close()
void
void
commit()
createArrayOf
(String typeName, Object[] elements) createStatement
(int resultSetType, int resultSetConcurrency) createStatement
(int resultSetType, int resultSetConcurrency, int resultSetHoldability) createStruct
(String typeName, Object[] attributes) protected void
void
disable()
void
boolean
getClientInfo
(String name) long
long
long
int
int
long
long
int
handleException
(Throwable t, String sql) boolean
boolean
isClosed()
boolean
boolean
isOracle()
boolean
boolean
boolean
isValid
(int timeout) prepareCall
(String sql) prepareCall
(String sql, int resultSetType, int resultSetConcurrency) prepareCall
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement
(String sql) prepareStatement
(String sql, int autoGeneratedKeys) prepareStatement
(String sql, int[] columnIndexes) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement
(String sql, String[] columnNames) void
recycle()
void
releaseSavepoint
(Savepoint savepoint) void
void
void
rollback()
void
void
setAutoCommit
(boolean autoCommit) void
setCatalog
(String catalog) void
setClientInfo
(String name, String value) void
setClientInfo
(Properties properties) void
void
setConnectedTimeNano
(long connectedTimeNano) void
setConnectStackTrace
(StackTraceElement[] connectStackTrace) void
setHoldability
(int holdability) void
setNetworkTimeout
(Executor executor, int milliseconds) void
setReadOnly
(boolean readOnly) setSavepoint
(String name) void
void
setTraceEnable
(boolean traceEnable) void
setTransactionIsolation
(int level) void
setTypeMap
(Map<String, Class<?>> map) void
toString()
protected void
transactionRecord
(String sql) Methods inherited from class com.alibaba.druid.pool.PoolableWrapper
isWrapperFor, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Field Details
-
MAX_RECORD_SQL_COUNT
public static final int MAX_RECORD_SQL_COUNT- See Also:
-
conn
-
holder
-
transactionInfo
-
traceEnable
protected volatile boolean traceEnable -
disable
protected volatile boolean disable -
closed
protected volatile boolean closed -
ownerThread
-
connectStackTrace
-
disableError
-
closing
protected volatile int closing -
filterChain
-
-
Constructor Details
-
DruidPooledConnection
-
-
Method Details
-
getConnectedTimeMillis
public long getConnectedTimeMillis() -
getOwnerThread
-
getConnectStackTrace
-
setConnectStackTrace
-
getConnectedTimeNano
public long getConnectedTimeNano() -
setConnectedTimeNano
public void setConnectedTimeNano() -
setConnectedTimeNano
public void setConnectedTimeNano(long connectedTimeNano) -
isTraceEnable
public boolean isTraceEnable() -
setTraceEnable
public void setTraceEnable(boolean traceEnable) -
handleException
- Throws:
SQLException
-
handleException
- Throws:
SQLException
-
isOracle
public boolean isOracle() -
closePoolableStatement
- Throws:
SQLException
-
getConnectionHolder
-
getConnection
- Specified by:
getConnection
in interfacePooledConnection
-
disable
public void disable() -
disable
-
isDisable
public boolean isDisable() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Specified by:
close
in interfacePooledConnection
- Throws:
SQLException
-
syncClose
- Throws:
SQLException
-
recycle
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
nativeSQL
- Specified by:
nativeSQL
in interfaceConnection
- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommit
in interfaceConnection
- Throws:
SQLException
-
transactionRecord
- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommit
in interfaceConnection
- Throws:
SQLException
-
commit
- Specified by:
commit
in interfaceConnection
- Throws:
SQLException
-
getTransactionInfo
-
createTransactionInfo
protected void createTransactionInfo() -
rollback
- Specified by:
rollback
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
-
createClob
- Specified by:
createClob
in interfaceConnection
- Throws:
SQLException
-
isClosed
- Specified by:
isClosed
in interfaceConnection
- Throws:
SQLException
-
isAbandonded
public boolean isAbandonded() -
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
-
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
-
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
-
addConnectionEventListener
- Specified by:
addConnectionEventListener
in interfacePooledConnection
-
removeConnectionEventListener
- Specified by:
removeConnectionEventListener
in interfacePooledConnection
-
addStatementEventListener
- Specified by:
addStatementEventListener
in interfacePooledConnection
-
removeStatementEventListener
- Specified by:
removeStatementEventListener
in interfacePooledConnection
-
getDisableError
-
checkState
- Throws:
SQLException
-
toString
-
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
-
abandond
public void abandond() -
getPhysicalConnectNanoSpan
public long getPhysicalConnectNanoSpan()- Since:
- 1.0.17
-
getPhysicalConnectionUsedCount
public long getPhysicalConnectionUsedCount()- Since:
- 1.0.17
-
getConnectNotEmptyWaitNanos
public long getConnectNotEmptyWaitNanos()- Since:
- 1.0.17
-
getVariables
- Since:
- 1.0.28
-
getGloablVariables
- Since:
- 1.0.28
-