Package ru.bgcrm.util.sql
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.-
Field Summary
Fields inherited from class ru.bgcrm.util.sql.ConnectionSet
KEY, TYPE_FAKE, TYPE_MASTER, TYPE_SLAVE, TYPE_TRASH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets slave connection to read-only DB replica.getTrashConnection(String tableName, int defaultType) Gets connection to so-called 'trash' DB, containing non-critical data.Methods inherited from class ru.bgcrm.util.sql.ConnectionSet
close, commit, getConnection, recycle, rollback
-
Constructor Details
-
SingleConnectionSet
-
-
Method Details
-
getSlaveConnection
Description copied from class:ConnectionSetGets slave connection to read-only DB replica.- Overrides:
getSlaveConnectionin classConnectionSet- Returns:
-
getTrashConnection
Description copied from class:ConnectionSetGets connection to so-called 'trash' DB, containing non-critical data.- Overrides:
getTrashConnectionin classConnectionSet- Parameters:
tableName- table name.defaultType- 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:
-