Package overit.geocall.sql
Class ConnectionPool<PC extends PooledConnection>
java.lang.Object
overit.geocall.sql.ConnectionPool<PC>
- Direct Known Subclasses:
DataSourceConnectionPool,DumbConnectionPool,ElasticConnectionPool,StandardConnectionPool
Abstract class that defines the functionality of a Connection Pool, that is a cache of database connections
maintained so that the connections can be reused when future requests to the database are required.
Connection pools are used to enhance the performance of executing commands on a database.
Connection pools are used to enhance the performance of executing commands on a database.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBObjectMapprotected String[]protected MutableNumberprotected Stringprotected EventHistoryprotected EventHistoryprotected Stringprotected Stringstatic final StringDefines the datasource typestatic final StringDefines the elastic connection's pool typestatic final StringDefines the standard type -
Constructor Summary
ConstructorsConstructorDescriptionConnectionPool(String name) Creates a ConnectionPool with the specified name and parameters -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Disposes the ConnectionPool.abstract PCgetConnection(String activity) Extracts a Connection from the poolabstract List<PooledConnectionInfo> Returns the informations about the connections of the poolgetCross()Returns the crossgetDBObjectMap(@NotNull DBType dbType) Returns theDBObjectMap, the map between Java objects in memory and SQL objects, used by this instance of ConnectionPoolReturns theDBTypeof the database.Returns aStringabout the encryption key.Returns theEventHistorythat contains the historyReturns the maximumMutableNumberof rows that can be extracted by the querygetName()Returns the name of the ConnectionPoolReturns theStringGetterof the database parameters (for example the TABLESPACE names)Returns theEventHistorythat contains the history of the queryabstract intlocked()Returns the number of locked connections, i.e. the connections that are currently used by the applicationabstract voidreleaseConnection(PC pc) Releases a Connection previously extracted withgetConnection()voidSets the crossvoidSets theDBTypeof the database.voidsetEncryptionKey(String encryptionKey) Sets the encryption key.abstract intsize()Returns the size of the ConnectionPool
-
Field Details
-
TYPE_STANDARD
Defines the standard type- See Also:
-
TYPE_DATASOURCE
Defines the datasource type- See Also:
-
TYPE_ELASTIC
Defines the elastic connection's pool type- See Also:
-
_name
-
cross
-
encryptionKey
-
_dbSetupStatments
-
_dbom
-
_maxQueryRows
-
_ph
-
_qh
-
-
Constructor Details
-
ConnectionPool
Creates a ConnectionPool with the specified name and parameters- Parameters:
name- The name of the ConnectionPool
-
-
Method Details
-
getCross
Returns the cross- Returns:
- The cross
-
setCross
Sets the cross- Parameters:
cross- The cross
-
getEncryptionKey
Returns aStringabout the encryption key.- Returns:
- a
Stringabout the encryption key.
-
setEncryptionKey
Sets the encryption key.- Parameters:
encryptionKey-Stringabout the encryption key.
-
getQueryHistory
Returns theEventHistorythat contains the history of the query- Returns:
- The history of the query
-
getHistory
Returns theEventHistorythat contains the history- Returns:
- The history
-
getName
Returns the name of the ConnectionPool- Returns:
- The string that contains the name of the ConnectionPool
-
getDBObjectMap
Returns theDBObjectMap, the map between Java objects in memory and SQL objects, used by this instance of ConnectionPool- Returns:
- The
DBObjectMap, the map between Java objects in memory and SQL objects, used by this instance of ConnectionPool
-
getParameters
Returns theStringGetterof the database parameters (for example the TABLESPACE names)- Returns:
- The database parameters
-
getMaxQueryRows
Returns the maximumMutableNumberof rows that can be extracted by the query- Returns:
- The maximum number of rows that can be extracted
-
getConnection
Extracts a Connection from the pool- Parameters:
activity- The motivation / operation for which the extract request originates- Returns:
- The Connection extracted
- Throws:
SQLException- If there is an error during the extraction, anSQLExceptionwill be raised
-
releaseConnection
Releases a Connection previously extracted withgetConnection()- Parameters:
pc- The Connection to release- Throws:
SQLException- If there is an error during the release, anSQLExceptionwill be raised
-
getConnectionInfo
Returns the informations about the connections of the pool- Returns:
- The List that contains the informations about the connections
-
dispose
public void dispose()Disposes the ConnectionPool. Use this method when the object is no longer needed, for example when the application is closed -
locked
public abstract int locked()Returns the number of locked connections, i.e. the connections that are currently used by the application- Returns:
- The number of currently locked connections
-
size
public abstract int size()Returns the size of the ConnectionPool- Returns:
- The number of Connection of this instance of ConnectionPool
-
getDBType
Returns theDBTypeof the database.- Returns:
- The
DBTypeof the database.
-
setDBType
Sets theDBTypeof the database.- Parameters:
dbType- TheDBTypeof the database.
-