Class ConnectionPool
java.lang.Object
org.bgerp.util.sql.pool.ConnectionPool
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getConnectionSet(boolean autoCommit) final ConnectionReturns a connection to the Master DB from the poolfinal ConnectionReturns a connection to the Slave DB from the pool.final ConnectionReturns a connection to the Slave DB from the pool.final ConnectiongetDBTrashConnectionFromPool(String tableName, int retType) Returns a connection to the trash DB if it's configured for the table, or depending on retTypefinal ConnectiongetDBTrashOrMasterConnectionFromPool(String tableName) Returns a connection to the dedicated "trash" or Master database (if the trash database is not found)final ConnectiongetDBTrashOrSlaveConnectionFromPool(String tableName) Returns a connection to the dedicated "trash" or Slave databaseReturns identifiers of slave databasesfinal DataSourceReturns identifiers of trash databasesfinal ConnectiongetTrashConnectionFromPool(String poolId) Returns a connection to the trash database.booleanisReplicationAvailable(String slaveId) Deprecated.booleanisReplicationNotBehindMaster(String slaveId) Deprecated.voidsetReplicationNotBehindMaster(String slaveId, boolean isNotBehind) Deprecated.
-
Field Details
-
RETURN_NULL
public static final int RETURN_NULL- See Also:
-
RETURN_FAKE
public static final int RETURN_FAKE- See Also:
-
RETURN_SLAVE
public static final int RETURN_SLAVE- See Also:
-
RETURN_MASTER
public static final int RETURN_MASTER- See Also:
-
-
Constructor Details
-
ConnectionPool
-
-
Method Details
-
getDataSource
-
getConnectionSet
-
getConnectionSet
-
close
public void close() -
getDBConnectionFromPool
Returns a connection to the Master DB from the pool- Returns:
- the connection to the Master DB, or
nullif unavailable
-
getSlaveDataSource
-
getDBSlaveConnectionFromPool
Returns a connection to the Slave DB from the pool. If Slave DB isn't defined in the configuration - returns from the Master pool.- Returns:
- the connection
-
getDBSlaveConnectionFromPool
Returns a connection to the Slave DB from the pool. If Slave DB isn't defined in the configuration - returns from the Master pool.- Parameters:
master- iffalse, returnsnullwhen there are no slave bases- Returns:
- the connection
-
getDBTrashConnectionFromPool
Returns a connection to the trash DB if it's configured for the table, or depending on retType- Parameters:
tableName- table nameretType-RETURN_FAKE,RETURN_SLAVEorRETURN_MASTER- Returns:
- if trash DB configuration is not specified, a connection to the master DB, a fake connection, or a connection to the Slave DB may be returned
-
getDBTrashOrMasterConnectionFromPool
Returns a connection to the dedicated "trash" or Master database (if the trash database is not found)- Parameters:
tableName-- Returns:
- the connection
-
getDBTrashOrSlaveConnectionFromPool
Returns a connection to the dedicated "trash" or Slave database- Parameters:
tableName-- Returns:
- the connection
-
getSlaveBaseId
-
getTrashBaseId
-
getTrashConnectionFromPool
Returns a connection to the trash database. If the database ID is incorrect, returnsnullwith all the consequences, since this is used only for forced database selection in some specific service cases.- Parameters:
poolId- - database ID- Returns:
- connection
-
poolStatus
- Returns:
- status text report for connection pools
-
getDbTrace
- Returns:
- pool connections borrowing stack traces text report
-
setReplicationNotBehindMaster
Deprecated.Enables/disables the Slave database lag flag- Parameters:
slaveId- Slave database identifierisNotBehind-true- lag disabled,false- lag enabled
-
isReplicationNotBehindMaster
Deprecated.Checks whether the Slave database is lagging- Parameters:
slaveId- Slave database identifier- Returns:
trueif not lagging
-
isReplicationAvailable
Deprecated.Checks availability of the Slave database- Parameters:
slaveId- Slave database identifier- Returns:
trueif available,falseif not available
-