Class TaskExecutor
java.lang.Object
dev.despical.pixelpainter.service.TaskExecutor
- All Implemented Interfaces:
AutoCloseable
Runs bounded image and file work and returns results to the global region thread.
Two workers share a queue with eight waiting tasks. Saturation reports a configured queue-full failure instead of allocating an unbounded backlog. Worker tasks must not access live Bukkit worlds or send player messages.
Success and failure callbacks are scheduled on the global region thread while the plugin is enabled. Shutdown stops accepting work and gives pending file operations up to ten seconds to finish. A completed journal remains usable on disk even when shutdown prevents delivery of its callback.
-
Constructor Summary
ConstructorsConstructorDescriptionTaskExecutor(org.bukkit.plugin.java.JavaPlugin plugin) Creates the bounded executor without starting any work. -
Method Summary
-
Constructor Details
-
TaskExecutor
public TaskExecutor(org.bukkit.plugin.java.JavaPlugin plugin) Creates the bounded executor without starting any work.- Parameters:
plugin- owner used to schedule callbacks
-
-
Method Details
-
submit
Submits a task and delivers its result on the global region thread.- Type Parameters:
T- result type- Parameters:
task- blocking work without live world accesscompleted- global-region success callbackfailed- global-region error callback; rejection is delivered immediately
-
close
public void close()Stops submissions and waits for pending work before interrupting workers.- Specified by:
closein interfaceAutoCloseable
-