Class UiRuntime
java.lang.Object
com.ultikits.ultitools.ui.runtime.UiRuntime
- All Implemented Interfaces:
AutoCloseable
Shared registration, lifecycle and ordered execution for all owners' UI services.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<UUID, RuntimeSession<?>> private final List<UiRuntime.BackendEntry> private boolean(package private) final ContainerRuntimeprivate final Map<UUID, ViewerLane> (package private) final Objectprivate final Loggerprivate final LongSupplierprivate final Set<RuntimeUiService> private final GlobalPump(package private) final Schedulerprivate final Threadprivate final Set<RuntimeSession<?>> private @Nullable Longprivate final long -
Constructor Summary
ConstructorsConstructorDescriptionUiRuntime(Scheduler scheduler, ContainerRuntime containers, Logger logger, Thread serverThread) Creates the runtime with framework-owned scheduling and the server thread.UiRuntime(Scheduler scheduler, ContainerRuntime containers, Logger logger, Thread serverThread, Duration unloadWait) UiRuntime(Scheduler scheduler, ContainerRuntime containers, Logger logger, Thread serverThread, Duration unloadWait, LongSupplier nanoTime) -
Method Summary
Modifier and TypeMethodDescription(package private) booleanactivate(RuntimeSession<?> session, UiBackend backend) (package private) booleanadd(RuntimeSession<?> session) booleanapplyGesture(GridSession session, ViewerItems side, Gesture gesture) Applies a gesture against the backend's rendered snapshot, refusing a terminal session.voidStarts one shared storage-wait budget for the complete server stop; repeated calls never extend it.(package private) voidvoidclose()voiddeferInterruptedClose(GridSession session) Defers CANT_USE's reason to the original close continuation, allowing a same-tick quit to win.(package private) boolean(package private) ViewerLanelane(org.bukkit.entity.Player viewer) (package private) voidReturns a diagnostic name for backend logging, read once when opening a session.private RuntimeGridSessionownGrid(GridSession session) picture(GridSession session) Returns defensive copies of the last drawn bound slots.voidquit(org.bukkit.entity.Player player) Handles a viewer quitting; continuations move to the global pump.(package private) voidredraw(SlotContainer container) voidRegisters a backend, rejecting an equal priority independently of the supported intent types.(package private) voidremoveLocked(RuntimeSession<?> session) rendered(GridSession session) Returns the immutable grid snapshot used for gestures and the last backend notification.(package private) voidreplacePrevious(RuntimeSession<?> session) (package private) static voidrethrowFatal(Throwable failure) (package private) @Nullable UiBackendselect(RuntimeSession<?> session) Issues a fresh service for one module copy.voidSynchronously unloads exactly the module copy that received this service, never a same-name replacement.private voidunloadService(RuntimeUiService service) (package private) void
-
Field Details
-
lock
-
scheduler
-
containers
-
logger
-
serverThread
-
pump
-
owners
-
backends
-
sessions
-
active
-
lanes
-
closed
private boolean closed -
unloadWaitNanos
private final long unloadWaitNanos -
nanoTime
-
shutdownBudgetNanos
-
-
Constructor Details
-
UiRuntime
public UiRuntime(Scheduler scheduler, ContainerRuntime containers, Logger logger, Thread serverThread) Creates the runtime with framework-owned scheduling and the server thread. -
UiRuntime
UiRuntime(Scheduler scheduler, ContainerRuntime containers, Logger logger, Thread serverThread, Duration unloadWait) -
UiRuntime
UiRuntime(Scheduler scheduler, ContainerRuntime containers, Logger logger, Thread serverThread, Duration unloadWait, LongSupplier nanoTime)
-
-
Method Details
-
service
-
ownerName
-
register
Registers a backend, rejecting an equal priority independently of the supported intent types. -
lane
-
add
-
select
-
replacePrevious
-
activate
-
removeLocked
-
deferInterruptedClose
Defers CANT_USE's reason to the original close continuation, allowing a same-tick quit to win. Cleanup is not queued a second tick later. The viewer lane hands off to the global pump on retirement. -
quit
public void quit(org.bukkit.entity.Player player) Handles a viewer quitting; continuations move to the global pump. -
unload
Synchronously unloads exactly the module copy that received this service, never a same-name replacement. -
unloadService
-
applyGesture
Applies a gesture against the backend's rendered snapshot, refusing a terminal session. -
rendered
Returns the immutable grid snapshot used for gestures and the last backend notification. -
picture
Returns defensive copies of the last drawn bound slots. -
ownGrid
-
redraw
-
isServerThread
boolean isServerThread() -
checkThread
void checkThread() -
warn
-
log
-
rethrowFatal
-
beginShutdown
public void beginShutdown()Starts one shared storage-wait budget for the complete server stop; repeated calls never extend it. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-