Class SingleConnectionSet
java.lang.Object
ru.bgcrm.util.sql.ConnectionSet
ru.bgcrm.util.sql.SingleConnectionSet
- All Implemented Interfaces:
AutoCloseable
Implementation of
ConnectionSet returning always the same master connection.
Eliminates advantages of real connection set, can be used as quick adapter.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets slave connection to read-only DB replicagetTrashConnection(String tableName, int defaultType) Gets connection to so-called 'trash' DB, containing non-critical dataMethods inherited from class ConnectionSet
close, commit, context, getConnection, recycle, rollback, toContext
-
Constructor Details
-
SingleConnectionSet
-
-
Method Details
-
getSlaveConnection
Description copied from class:ConnectionSetGets slave connection to read-only DB replica- Overrides:
getSlaveConnectionin classConnectionSet- Returns:
- the slave connection
-
getTrashConnection
Description copied from class:ConnectionSetGets connection to so-called 'trash' DB, containing non-critical data- Overrides:
getTrashConnectionin classConnectionSet- Parameters:
tableName- table namedefaultType- DB type returned if no trash DB is configured, can be:ConnectionSet.TYPE_SLAVE- slave DB connection;ConnectionSet.TYPE_FAKE- instance ofFakeConnection, does not do anything;ConnectionSet.TYPE_MASTER- master DB connection.- Returns:
- the connection
-