Class SingleConnectionSet

java.lang.Object
ru.bgcrm.util.sql.ConnectionSet
ru.bgcrm.util.sql.SingleConnectionSet
All Implemented Interfaces:
AutoCloseable

public class SingleConnectionSet extends ConnectionSet
Implementation of ConnectionSet returning always the same master connection. Eliminates advantages of real connection set, can be used as quick adapter.
  • Constructor Details

    • SingleConnectionSet

      public SingleConnectionSet(Connection master)
  • Method Details

    • getSlaveConnection

      public Connection getSlaveConnection()
      Description copied from class: ConnectionSet
      Gets slave connection to read-only DB replica
      Overrides:
      getSlaveConnection in class ConnectionSet
      Returns:
      the slave connection
    • getTrashConnection

      public Connection getTrashConnection(String tableName, int defaultType)
      Description copied from class: ConnectionSet
      Gets connection to so-called 'trash' DB, containing non-critical data
      Overrides:
      getTrashConnection in class ConnectionSet
      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 of FakeConnection, does not do anything;
      ConnectionSet.TYPE_MASTER - master DB connection.
      
      Returns:
      the connection