Class SQLDB
java.lang.Object
com.djrapitops.plan.storage.database.AbstractDatabase
com.djrapitops.plan.storage.database.SQLDB
- All Implemented Interfaces:
Database
Class containing main logic for different data related save and load functionality.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.djrapitops.plan.storage.database.Database
Database.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final dev.vankka.dependencydownload.ApplicationDependencyManagerprotected final PlanConfigprotected ClassLoaderprotected final ErrorLoggerprotected final PlanFilesprotected final Localeprotected final net.playeranalytics.plugin.server.PluginLoggerprotected final net.playeranalytics.plugin.scheduling.RunnableFactoryFields inherited from class com.djrapitops.plan.storage.database.AbstractDatabase
accessLock -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSQLDB(Supplier<ServerUUID> serverUUIDSupplier, Locale locale, PlanConfig config, PlanFiles files, net.playeranalytics.plugin.scheduling.RunnableFactory runnableFactory, net.playeranalytics.plugin.server.PluginLogger logger, ErrorLogger errorLogger, dev.vankka.dependencydownload.ApplicationDependencyManager applicationDependencyManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanvoidclose()voidbooleanexecuteTransaction(Transaction transaction) Execute an SQL Transaction.abstract Connectionnet.playeranalytics.plugin.server.PluginLoggernet.playeranalytics.plugin.scheduling.RunnableFactorystatic ThreadLocal<StackTraceElement[]> intinthashCode()voidinit()Initializes the Database.<T> TExecute an SQL Query statement to get a result.<T> TqueryWithinTransaction(Query<T> query, Transaction transaction) abstract voidreturnToPool(Connection connection) static voidsetDownloadDriver(boolean downloadDriver) voidsetTransactionExecutorServiceProvider(Supplier<ExecutorService> transactionExecutorServiceProvider) abstract voidSet up the source for connections.booleanprotected voidMethods inherited from class com.djrapitops.plan.storage.database.AbstractDatabase
assumeNoMoreHeavyLoad, getHeavyLoadDelayMs, getState, increaseHeavyLoadDelay, isUnderHeavyLoad, setStateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.djrapitops.plan.storage.database.Database
getSql, getType, queryCollection, queryList, queryMap, queryMap, queryOptional, querySet
-
Field Details
-
locale
-
config
-
files
-
runnableFactory
protected final net.playeranalytics.plugin.scheduling.RunnableFactory runnableFactory -
logger
protected final net.playeranalytics.plugin.server.PluginLogger logger -
errorLogger
-
applicationDependencyManager
protected final dev.vankka.dependencydownload.ApplicationDependencyManager applicationDependencyManager -
driverClassLoader
-
-
Constructor Details
-
SQLDB
protected SQLDB(Supplier<ServerUUID> serverUUIDSupplier, Locale locale, PlanConfig config, PlanFiles files, net.playeranalytics.plugin.scheduling.RunnableFactory runnableFactory, net.playeranalytics.plugin.server.PluginLogger logger, ErrorLogger errorLogger, dev.vankka.dependencydownload.ApplicationDependencyManager applicationDependencyManager)
-
-
Method Details
-
setDownloadDriver
public static void setDownloadDriver(boolean downloadDriver) -
getDependencyResource
-
downloadDriver
public void downloadDriver() -
getTransactionOrigin
-
init
public void init()Description copied from interface:DatabaseInitializes the Database.Queries can be performed after this request has completed all required transactions for the database operations.
-
attemptToCloseTransactionExecutor
protected boolean attemptToCloseTransactionExecutor() -
setupDataSource
public abstract void setupDataSource()Set up the source for connections.- Throws:
DBInitException- If the DataSource fails to be initialized.
-
forceCloseTransactionExecutor
-
close
public void close() -
getConnection
- Throws:
SQLException
-
returnToPool
-
query
Description copied from interface:DatabaseExecute an SQL Query statement to get a result.This method should only be called from an asynchronous thread.
- Type Parameters:
T- Type of the object to be returned.- Parameters:
query- QueryStatement to execute.- Returns:
- Result of the query.
-
queryWithinTransaction
-
unloadDriverClassloader
protected void unloadDriverClassloader() -
executeTransaction
Description copied from interface:DatabaseExecute an SQL Transaction.- Parameters:
transaction- Transaction to execute.- Returns:
- Future that is finished when the transaction has been executed.
-
equals
-
hashCode
public int hashCode() -
getServerUUIDSupplier
-
setTransactionExecutorServiceProvider
public void setTransactionExecutorServiceProvider(Supplier<ExecutorService> transactionExecutorServiceProvider) -
getRunnableFactory
public net.playeranalytics.plugin.scheduling.RunnableFactory getRunnableFactory() -
getLogger
public net.playeranalytics.plugin.server.PluginLogger getLogger() -
getLocale
-
shouldDropUnimportantTransactions
public boolean shouldDropUnimportantTransactions() -
getTransactionQueueSize
public int getTransactionQueueSize()
-