Package overit.geocall.sql
Class PooledConnection
java.lang.Object
overit.geocall.sql.PooledConnection
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
DataSourcePooledConnection,ElasticPooledConnection,StandardPooledConnection
The class defines a connection that can be inserted into any implementation of
ConnectionPool-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConnectionPoolRefers to the pool from which the connection was extracted.protected ArrayList<DBStatement> Contains the list ofDBStatementopened by the connection through thegetDBStatement()method.protected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheck()voidclose()Invoked by the application to make the release effective on the connection poolvoidcommit()Makes a commit on the connectionabstract ConnectionReturns the JDBC connection used by the instanceAsks to the connection to instanciate aDBStatementabstract PooledConnectionInfogetInfo()Returns some informations about the connection, such the last connection time, last release time, etc.ReturnPooledConnection.Metadatathat can be used to retrieve information about DB tables and table-spacesgetPool()Returns the connection pool from which the connection was extractedbooleanisDied()voidrelease()Invoked by the application to make the release effective on the connection poolvoidReturns, for closing, a statement previously requested to the connectionvoidrollback()Makes a rollback on the connectionprotected static void
-
Field Details
-
died
protected boolean died -
_connectionpool
Refers to the pool from which the connection was extracted. It can be null if it has not yet been extracted or if the pool to which it belongs has never been specified -
_dbstatements
Contains the list ofDBStatementopened by the connection through thegetDBStatement()method. This list is maintained in such a way that each release of the connection automatically closes the statements
-
-
Constructor Details
-
PooledConnection
public PooledConnection()
-
-
Method Details
-
check
protected void check() -
unsupported
protected static void unsupported() -
isDied
public boolean isDied() -
getConnection
Returns the JDBC connection used by the instance- Returns:
- The JDBC connection
-
getPool
Returns the connection pool from which the connection was extracted- Returns:
- The connection pool from which the connection was extracted
-
getInfo
Returns some informations about the connection, such the last connection time, last release time, etc.- Returns:
- The
PooledConnectionInfoobject that contains some informations about the connection
-
getMetadata
ReturnPooledConnection.Metadatathat can be used to retrieve information about DB tables and table-spaces- Returns:
- the
PooledConnection.Metadatainstance based on the current db type
-
release
Invoked by the application to make the release effective on the connection pool- Throws:
SQLException- The release of a connection to the instance can lead an opening or a closure, therefore it can raise an SQL exception
-
close
Invoked by the application to make the release effective on the connection pool- Specified by:
closein interfaceAutoCloseable- Throws:
SQLException- The release of a connection to the instance can lead an opening or a closure, therefore it can raise an SQL exception
-
getDBStatement
Asks to the connection to instanciate aDBStatement- Returns:
- A new instance of
DBStatement. The connection can make the statement inherit the properties of theStandardPooledConnection - Throws:
SQLException- If the communication with the database throws an exception, that it is raised to the caller
-
releaseDBStatement
Returns, for closing, a statement previously requested to the connection- Parameters:
dbs- The statement previously requested to the connection- Throws:
SQLException- The release of a connection lead to a closure, therefore it can raise an SQL exception
-
commit
Makes a commit on the connection- Throws:
SQLException- If the communication with the database throws an exception, that it is raised to the caller
-
rollback
Makes a rollback on the connection- Throws:
SQLException- If the communication with the database throws an exception, that it is raised to the caller
-