Package com.aoindustries.sql
Class AOConnectionPool
- java.lang.Object
-
- java.lang.Thread
-
- com.aoindustries.io.AOPool<Connection,SQLException,SQLException>
-
- com.aoindustries.sql.AOConnectionPool
-
- All Implemented Interfaces:
Runnable
public final class AOConnectionPool extends AOPool<Connection,SQLException,SQLException>
Reusable connection pooling with dynamic flaming tiger feature.- Author:
- AO Industries, Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class com.aoindustries.io.AOPool
DEFAULT_CONNECT_TIMEOUT, DEFAULT_DELAY_TIME, DEFAULT_MAX_CONNECTION_AGE, DEFAULT_MAX_IDLE_TIME, DEFAULT_SOCKET_SO_LINGER, logger, UNLIMITED_MAX_CONNECTION_AGE
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclose(Connection conn)ConnectiongetConnection()Gets a read/write connection to the database with a transaction level of Connection.TRANSACTION_READ_COMMITTED and a maximum connections of 1.ConnectiongetConnection(boolean readOnly)Gets a connection to the database with a transaction level of Connection.TRANSACTION_READ_COMMITTED and a maximum connections of 1.ConnectiongetConnection(int isolationLevel, boolean readOnly)Gets a connection to the database with a maximum connections of 1.ConnectiongetConnection(int isolationLevel, boolean readOnly, int maxConnections)protected ConnectiongetConnectionObject()Creates a new connection.protected booleanisClosed(Connection conn)protected SQLExceptionnewException(String message, Throwable cause)protected SQLExceptionnewInterruptedException(String message, Throwable cause)protected voidprintConnectionStats(Appendable out, boolean isXhtml)Prints additional connection pool details.protected voidresetConnection(Connection conn)StringtoString()-
Methods inherited from class com.aoindustries.io.AOPool
close, getConcurrency, getConnection, getConnectionCount, getConnects, getLogger, getMaxConcurrency, getMaxConnectionAge, getPoolSize, getTotalTime, getTransactionCount, printStatisticsHTML, printStatisticsHTML, releaseConnection, run
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
-
-
-
-
Method Detail
-
close
protected void close(Connection conn) throws SQLException
- Specified by:
closein classAOPool<Connection,SQLException,SQLException>- Throws:
SQLException
-
getConnection
public Connection getConnection() throws SQLException
Gets a read/write connection to the database with a transaction level of Connection.TRANSACTION_READ_COMMITTED and a maximum connections of 1.- Overrides:
getConnectionin classAOPool<Connection,SQLException,SQLException>- Returns:
- The read/write connection to the database
- Throws:
SQLException- See Also:
AOPool.getConnection(int)
-
getConnection
public Connection getConnection(boolean readOnly) throws SQLException
Gets a connection to the database with a transaction level of Connection.TRANSACTION_READ_COMMITTED and a maximum connections of 1.- Parameters:
readOnly- Theread-only flag- Returns:
- The connection to the database
- Throws:
SQLException
-
getConnection
public Connection getConnection(int isolationLevel, boolean readOnly) throws SQLException
Gets a connection to the database with a maximum connections of 1.- Parameters:
isolationLevel- Thetransaction isolation levelreadOnly- Theread-only flag- Returns:
- The connection to the database
- Throws:
SQLException
-
getConnection
public Connection getConnection(int isolationLevel, boolean readOnly, int maxConnections) throws SQLException
- Throws:
SQLException
-
getConnectionObject
protected Connection getConnectionObject() throws SQLException
Description copied from class:AOPoolCreates a new connection.- Specified by:
getConnectionObjectin classAOPool<Connection,SQLException,SQLException>- Throws:
SQLException
-
isClosed
protected boolean isClosed(Connection conn) throws SQLException
- Specified by:
isClosedin classAOPool<Connection,SQLException,SQLException>- Throws:
SQLException
-
printConnectionStats
protected void printConnectionStats(Appendable out, boolean isXhtml) throws IOException
Description copied from class:AOPoolPrints additional connection pool details. Must have opened the<tbody>.- Overrides:
printConnectionStatsin classAOPool<Connection,SQLException,SQLException>- Throws:
IOException
-
resetConnection
protected void resetConnection(Connection conn) throws SQLException
- Specified by:
resetConnectionin classAOPool<Connection,SQLException,SQLException>- Throws:
SQLException
-
newException
protected SQLException newException(String message, Throwable cause)
- Specified by:
newExceptionin classAOPool<Connection,SQLException,SQLException>
-
newInterruptedException
protected SQLException newInterruptedException(String message, Throwable cause)
- Specified by:
newInterruptedExceptionin classAOPool<Connection,SQLException,SQLException>
-
-