java.lang.Object
com.djrapitops.plan.storage.database.transactions.Transaction
Direct Known Subclasses:
BanStatusTransaction, CookieChangeTransaction, CreateIndexTransaction, OperationCriticalTransaction, PingStoreTransaction, PlayerRegisterTransaction, RegisterWebUserTransaction, RemoveWebUserTransaction, ShutdownDataPreservationTransaction, StoreConfigTransaction, StoreGeoInfoTransaction, StoreJoinAddressTransaction, StoreRequestTransaction, StoreServerInformationTransaction, StoreSessionTransaction, ThrowawayTransaction, TPSStoreTransaction, WorldNameStoreTransaction

public abstract class Transaction extends Object
Represents a database transaction.
  • Field Details

    • dbType

      protected DBType dbType
    • success

      protected boolean success
    • attempts

      protected int attempts
  • Constructor Details

    • Transaction

      protected Transaction()
  • Method Details

    • executeTransaction

      public void executeTransaction(SQLDB db)
    • shouldBeExecuted

      protected boolean shouldBeExecuted()
      Override this method for conditional execution.

      Please note that the transaction has not been initialized and class variables are not available for queries. The condition should depend on other variables (Like the data that is to be stored) given to the transaction.

      Returns:
      false if the transaction should not execute.
    • performOperations

      protected abstract void performOperations()
      Implement this method for transaction execution.
    • query

      protected <T> T query(Query<T> query)
    • execute

      protected boolean execute(Executable executable)
    • executeReturningId

      protected int executeReturningId(ExecStatement executable)
    • execute

      protected boolean execute(String sql)
    • executeSwallowingExceptions

      protected void executeSwallowingExceptions(String... statements)
    • executeOther

      protected void executeOther(Transaction transaction)
    • getDBState

      protected Database.State getDBState()
    • getServerUUID

      protected ServerUUID getServerUUID()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • wasSuccessful

      public boolean wasSuccessful()
    • dbIsNotUnderHeavyLoad

      public boolean dbIsNotUnderHeavyLoad()
    • getName

      public String getName()