Class Transaction
java.lang.Object
com.djrapitops.plan.storage.database.transactions.Transaction
- Direct Known Subclasses:
BanStatusTransaction,BatchBanStatusTransaction,ChangeUserUUIDTransaction,CookieChangeTransaction,CreateIndexTransaction,DeleteWebGroupTransaction,GrantWebPermissionToGroupsWithPermissionTransaction,OperationCriticalTransaction,PingStoreTransaction,PlayerRegisterTransaction,RemoveWebGroupsTransaction,RemoveWebUserTransaction,ShutdownDataPreservationTransaction,StoreAllowlistBounceTransaction,StoreConfigTransaction,StoreGeoInfoTransaction,StoreJoinAddressTransaction,StoreMissingWebPermissionsTransaction,StorePluginVersionsTransaction,StoreServerInformationTransaction,StoreSessionTransaction,StoreWebGroupTransaction,StoreWebUserPreferencesTransaction,StoreWebUserTransaction,StoreWorldNameTransaction,ThrowawayTransaction,TPSStoreTransaction
Represents a database transaction.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbooleanprotected booleanexecute(Executable executable) protected booleanprotected voidexecuteOther(Transaction transaction) protected intexecuteReturningId(ExecStatement executable) protected voidexecuteSwallowingExceptions(String... statements) voidprotected Database.StategetName()protected ServerUUIDprotected booleanprotected abstract voidImplement this method for transaction execution.protected <T> Tprotected booleanOverride this method for conditional execution.toString()boolean
-
Field Details
-
dbType
-
success
protected boolean success -
attempts
protected int attempts
-
-
Constructor Details
-
Transaction
protected Transaction()
-
-
Method Details
-
executeTransaction
-
commitMidTransaction
protected void commitMidTransaction() -
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
-
execute
-
executeReturningId
-
execute
-
executeSwallowingExceptions
-
executeOther
-
getDBState
-
getServerUUID
-
toString
-
wasSuccessful
public boolean wasSuccessful() -
dbIsNotUnderHeavyLoad
public boolean dbIsNotUnderHeavyLoad() -
getName
-
hasTable
-