Class BukkitSettleDispatcher
java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.pagination.source.BukkitSettleDispatcher
- All Implemented Interfaces:
SettleDispatcher
Default
SettleDispatcher: settles route to the viewer's region thread (Folia) or
the main thread (legacy Spigot/Paper) via the injected PlatformScheduler.
Routing rules:
- No viewer (
PageRequest.viewer()isnull) — engine-external test usage: settle runs inline on the completing thread. - The calling thread already owns the viewer's region — settle runs inline.
- Otherwise — the settle is dispatched to the viewer's entity scheduler.
Dispatch order is FIFO: inline settles run immediately; the scheduler runs same-tick
tasks in submission order. AsyncPageSource relies on this — a request's timeout
settle must reach the dispatcher before the cancellation settle it triggers.
A settle that is rejected because the owning plugin is disabling
(IllegalPluginAccessException) is dropped with a warning: the scheduler will not
accept new tasks at that point and the inventory is about to be closed anyway.
-
Constructor Summary
ConstructorsConstructorDescriptionBukkitSettleDispatcher(@NotNull PlatformScheduler scheduler) Creates the dispatcher. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatch(PageRequest request, Runnable task) Runs the settle task on the appropriate thread for the given request.
-
Constructor Details
-
BukkitSettleDispatcher
Creates the dispatcher.- Parameters:
scheduler- the platform scheduler used to route settles to the viewer's region
-
-
Method Details
-
dispatch
Description copied from interface:SettleDispatcherRuns the settle task on the appropriate thread for the given request.- Specified by:
dispatchin interfaceSettleDispatcher- Parameters:
request- the request being settled, never nulltask- the settle work, never null
-