Class DatabaseManager
- java.lang.Object
-
- com.alessiodp.core.common.storage.DatabaseManager
-
public abstract class DatabaseManager extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected IDatabaseDispatcherdatabaseprotected ExecutorServicedatabaseExecutorprotected ADPPluginplugin
-
Constructor Summary
Constructors Constructor Description DatabaseManager(@NotNull ADPPlugin plugin)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>executeSafelyAsync(Runnable runnable)<T> CompletableFuture<T>executeSafelySupplyAsync(Supplier<T> supplier)protected IDatabaseDispatcherinit(StorageType storageType)Initialize database managerprotected abstract IDatabaseDispatcherinitializeDispatcher(StorageType storageType)Initialize database dispatchervoidreload()Reload database managervoidstop()Stop all databases
-
-
-
Field Detail
-
plugin
protected final ADPPlugin plugin
-
databaseExecutor
protected final ExecutorService databaseExecutor
-
database
protected IDatabaseDispatcher database
-
-
Constructor Detail
-
DatabaseManager
public DatabaseManager(@NotNull @NotNull ADPPlugin plugin)
-
-
Method Detail
-
init
protected IDatabaseDispatcher init(StorageType storageType)
Initialize database manager- Parameters:
storageType- the storage type to initialize- Returns:
- the database dispatcher initialized
-
initializeDispatcher
protected abstract IDatabaseDispatcher initializeDispatcher(StorageType storageType)
Initialize database dispatcher- Parameters:
storageType- the storage type to initialize- Returns:
- the database dispatcher initialized
-
executeSafelyAsync
public CompletableFuture<Void> executeSafelyAsync(Runnable runnable)
-
executeSafelySupplyAsync
public <T> CompletableFuture<T> executeSafelySupplyAsync(Supplier<T> supplier)
-
reload
public void reload()
Reload database manager
-
stop
public final void stop()
Stop all databases
-
-