Class ConnectionSet

java.lang.Object
ru.bitel.common.sql.ConnectionSet
All Implemented Interfaces:
java.lang.AutoCloseable, ru.bitel.common.worker.Commitable, ru.bitel.common.worker.Recyclable

public abstract class ConnectionSet
extends java.lang.Object
implements ru.bitel.common.worker.Recyclable, ru.bitel.common.worker.Commitable, java.lang.AutoCloseable
Класс с коннекшнами к базе. Держать их по отдельности не всегда удобно.
  • Field Details

  • Constructor Details

    • ConnectionSet

      public ConnectionSet​(java.sql.Connection master, boolean autoCommit)
  • Method Details

    • getConnection

      public java.sql.Connection getConnection()
    • newMasterConnection

      protected abstract java.sql.Connection newMasterConnection()
    • newSlaveConnection

      protected abstract java.sql.Connection newSlaveConnection()
    • newTrashConnection

      protected abstract java.sql.Connection newTrashConnection​(java.lang.String tableName)
    • getSlaveConnection

      public java.sql.Connection getSlaveConnection()
    • getTrashConnection

      public java.sql.Connection getTrashConnection​(java.lang.String tableName, int defaultType)
    • commit

      public void commit() throws ru.bitel.bgbilling.common.BGException
      Specified by:
      commit in interface ru.bitel.common.worker.Commitable
      Throws:
      ru.bitel.bgbilling.common.BGException
    • recycle

      public void recycle()
      Specified by:
      recycle in interface ru.bitel.common.worker.Recyclable
    • getAutoCommit

      public boolean getAutoCommit()
    • setAutoCommit

      public void setAutoCommit​(boolean autoCommit)
    • rollback

      public void rollback()
    • finalize

      protected void finalize() throws java.lang.Throwable
      Overrides:
      finalize in class java.lang.Object
      Throws:
      java.lang.Throwable
    • newInstance

      public static final ConnectionSet newInstance​(DefaultServerSetup setup, boolean autoCommit)
    • newInstance

      public static final ConnectionSet newInstance​(DefaultServerSetup setup, java.sql.Connection con, boolean autoCommit)
    • close

      public void close()
      Specified by:
      close in interface java.lang.AutoCloseable