Class Transaction
- java.lang.Object
-
- com.djrapitops.plan.storage.database.transactions.Transaction
-
- Direct Known Subclasses:
BanStatusTransaction
,CookieChangeTransaction
,CreateIndexTransaction
,GeoInfoStoreTransaction
,OperationCriticalTransaction
,PingStoreTransaction
,PlayerRegisterTransaction
,RegisterWebUserTransaction
,RemoveWebUserTransaction
,SessionEndTransaction
,StoreConfigTransaction
,StoreServerInformationTransaction
,ThrowawayTransaction
,TPSStoreTransaction
,WorldNameStoreTransaction
public abstract class Transaction extends java.lang.Object
Represents a database transaction.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Transaction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
dbIsNotUnderHeavyLoad()
protected boolean
execute(Executable executable)
protected boolean
execute(java.lang.String sql)
protected void
executeOther(Transaction transaction)
protected void
executeSwallowingExceptions(java.lang.String... statements)
void
executeTransaction(SQLDB db)
protected Database.State
getDBState()
protected ServerUUID
getServerUUID()
protected abstract void
performOperations()
Implement this method for transaction execution.protected <T> T
query(Query<T> query)
protected boolean
shouldBeExecuted()
Override this method for conditional execution.java.lang.String
toString()
boolean
wasSuccessful()
-
-
-
Field Detail
-
dbType
protected DBType dbType
-
success
protected boolean success
-
attempts
protected int attempts
-
-
Method Detail
-
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)
-
execute
protected boolean execute(java.lang.String sql)
-
executeSwallowingExceptions
protected void executeSwallowingExceptions(java.lang.String... statements)
-
executeOther
protected void executeOther(Transaction transaction)
-
getDBState
protected Database.State getDBState()
-
getServerUUID
protected ServerUUID getServerUUID()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
wasSuccessful
public boolean wasSuccessful()
-
dbIsNotUnderHeavyLoad
public boolean dbIsNotUnderHeavyLoad()
-
-