public class DatabaseConnectionsPool
extends java.lang.Object
Title: Service Event Fabric Runtime
Description: Database connections pool.
Connection pool stores up to specified count of initialized and connection database connections. Connections are created using specified JDBCFactory. Unlike of JDBCFactory if connections are reliable only one connection observer thread is created for all connections in the pool.
Copyright: Copyright (c) 2014
Company: StreamScape Technologies
Constructor and Description |
---|
DatabaseConnectionsPool() |
Modifier and Type | Method and Description |
---|---|
DatabaseConnection |
get()
Returns fist dataspace connection from the top.
|
java.util.Map |
getConnectionExceptions()
Returns all connection latest exceptions.
|
java.util.Map |
getConnectionStates()
Returns all connections states.
|
java.util.Map |
getExceptionErrorsMap()
Return errors map.
|
JDBCFactory |
getFactory()
Returns JDBC factory.
|
DatabaseSQLException |
getLastException()
Returns last exception throws by connections.
|
java.lang.String |
getName()
Returns connection pool name.
|
DatabaseConnection |
getNoWait()
Return first connection from the top.
|
int |
getPoolSize()
Returns pool size.
|
ConnectionState |
getState()
Returns more popular connection state.
|
java.util.Map |
getStatesMap()
Return connections states map.
|
boolean |
isRunning()
Returns true if connections pool is running.
|
void |
release(DatabaseConnection connection)
Releases connection to the pool.
|
void |
setExceptionEventListener(ExceptionEventListener exceptionEventListener)
Sets exception event listener for all connections.
|
void |
setFactory(JDBCFactory factory)
Sets JDBC factory.
|
void |
setLogger(Logger logger)
Sets logger for all connections.
|
void |
setName(java.lang.String name)
Sets connection pool name.
|
void |
setPoolSize(int poolSize)
Sets pool size.
|
void |
setStateNotificationEventListener(StateNotificationEventListener stateNotificationEventListener)
Sets state notification listener for all connections.
|
void |
start()
Initializes connection and connect them.
If jdbc factory is reliable then one observer thread will be created. |
void |
stop()
Disconnects and destroys all connections.
|
public java.lang.String getName()
public void setName(java.lang.String name) throws DatabaseConnectionPoolException
name
- DatabaseConnectionPoolException
public void setFactory(JDBCFactory factory) throws DatabaseConnectionPoolException
factory
- DatabaseConnectionPoolException
public JDBCFactory getFactory()
public void setPoolSize(int poolSize) throws DatabaseConnectionPoolException
poolSize
- DatabaseConnectionPoolException
public int getPoolSize() throws JDBCConfigurationException
JDBCConfigurationException
public DatabaseConnection get() throws DatabaseConnectionPoolException, java.lang.InterruptedException
DatabaseConnectionPoolException
java.lang.InterruptedException
public DatabaseConnection getNoWait() throws DatabaseConnectionPoolException, java.lang.InterruptedException
DatabaseConnectionPoolException
java.lang.InterruptedException
public void release(DatabaseConnection connection) throws DatabaseConnectionPoolException
connection
- DatabaseConnectionPoolException
public void start() throws DatabaseConnectionPoolException
DatabaseConnectionPoolException
public void stop() throws DatabaseConnectionPoolException
DatabaseConnectionPoolException
public boolean isRunning()
public ConnectionState getState()
public java.util.Map getStatesMap()
public java.util.Map getConnectionStates()
public DatabaseSQLException getLastException()
public java.util.Map getExceptionErrorsMap()
public java.util.Map getConnectionExceptions()
public void setStateNotificationEventListener(StateNotificationEventListener stateNotificationEventListener)
stateNotificationEventListener
- public void setExceptionEventListener(ExceptionEventListener exceptionEventListener)
exceptionEventListener
- public void setLogger(Logger logger)
logger
- Copyright © 2015-2024 StreamScape Technologies. All rights reserved.