DeltaExecutor is an async task executor for Spigot servers.
- Uses a thread pool (which means threads are reused instead of recreated for every task)
- Supports a configurable nice shutdown that allows tasks to complete
- Supports task debugging
- Provides more information on a task status
DeltaExecutor exec = DeltaExecutor.instance()
Runnable r = ...
long taskId = DeltaExecutor.instance().execute(r);
CancelResult result = DeltaExecutor.instance().cancel(taskId);
switch(result) {
case CANCELLED:
// Handle the task being successfully cancelled
break;
case RUNNING:
// Handle the task failing to be cancelled due to it being currently run
break;
case NOT_FOUND:
// Handle the task not being found (completed task or not existent task)
break;
}
// It is recommended to call this onDisable() of all plugins that use DeltaExecutor
// It is safe to use shutdown() after using shutdown()
// The executor falls back to synchronous execution after shutdown
DeltaExecutor.instance().shutdown();
- Task Metadata
- Callable support
- Repeated async task support
Licence (GPLv3)
DeltaExecutor - Async task executor for Bukkit/Spigot servers.
Copyright (C) 2015 Trace Bachi ([email protected])
DeltaExecutor is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DeltaExecutor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeltaExecutor. If not, see <http://www.gnu.org/licenses/>.