mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-07 19:50:54 -06:00
Added initial version
This commit is contained in:
commit
b452bd670c
13290 changed files with 1178433 additions and 0 deletions
|
|
@ -0,0 +1,55 @@
|
|||
package ms.system.util;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/**
|
||||
* A class holding methods to execute tasks.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
public final class TaskExecutor {
|
||||
|
||||
/**
|
||||
* The executor to use.
|
||||
*/
|
||||
private static final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
/**
|
||||
* The SQL task executor.
|
||||
*/
|
||||
private static final ScheduledExecutorService SQL_EXECUTOR = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
/**
|
||||
* Constructs a new {@code TaskExecutor} {@code Object}.
|
||||
*/
|
||||
private TaskExecutor() {
|
||||
/*
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an SQL handling task.
|
||||
* @param task The task.
|
||||
*/
|
||||
public static void executeSQL(Runnable task) {
|
||||
SQL_EXECUTOR.execute(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the task.
|
||||
* @param task The task to execute.
|
||||
*/
|
||||
public static void execute(Runnable task) {
|
||||
EXECUTOR.execute(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the executor.
|
||||
* @return The executor.
|
||||
*/
|
||||
public static ScheduledExecutorService getExecutor() {
|
||||
return EXECUTOR;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue