Class FrameworkContainerRuntime
java.lang.Object
com.ultikits.ultitools.ui.container.FrameworkContainerRuntime
- All Implemented Interfaces:
ContainerRuntime
Module-copy ownership and the three synchronous unload phases for editable containers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final GestureEngineprivate final BooleanSupplierprivate final Map<UiOwner, FrameworkContainerRuntime.OwnerContainers> private @Nullable Duration -
Constructor Summary
ConstructorsConstructorDescriptionFrameworkContainerRuntime(BooleanSupplier onContainerThread, BiConsumer<org.bukkit.entity.Player, Text> refusalNotifier) Creates the editable runtime. -
Method Summary
Modifier and TypeMethodDescriptionvoidattach(SlotContainer container, UiSession<?> session) sessionnow showscontainer.private voidcreate(UiOwner owner, ContainerSpec spec, ContainerHost host) Creates a container for this module copy and its host.voiddetach(SlotContainer container, UiSession<?> session) sessionno longer showscontainer.(package private) voidended(UiOwner owner, FrameworkSlotContainer container) engine()The engine that applies gestures to this runtime's containers.voidfinishUnload(UiOwner owner, long deadlineNanos) Unload step 6: await answers until the same deadline and end every container of this copy.private static voidforEachContainer(FrameworkContainerRuntime.OwnerContainers group, String step, Consumer<FrameworkSlotContainer> action) private FrameworkSlotContainerown(SlotContainer container) private booleanownsContainer(SlotContainer container) voidprepareUnload(UiOwner owner, long deadlineNanos) Unload step 2: freeze new work for this module copy and retain the shared absolute System.nanoTime deadline.voidstartUnloadCommits(UiOwner owner) Unload step 4: start changed COMMIT writes for this copy, reusing any write already in flight.(package private) voidunloadWaitOverride(Duration wait) Shortens only the test budget, without replacing the service's absolute deadline.
-
Field Details
-
onContainerThread
-
owners
-
engine
-
unloadWaitOverride
-
-
Constructor Details
-
FrameworkContainerRuntime
public FrameworkContainerRuntime(BooleanSupplier onContainerThread, BiConsumer<org.bukkit.entity.Player, Text> refusalNotifier) Creates the editable runtime. The scheduler is supplied per owner by its host, never by a module.- Parameters:
onContainerThread- whether the caller may access container staterefusalNotifier- sends a refusal text in the viewer's locale
-
-
Method Details
-
checkThread
private void checkThread() -
create
Description copied from interface:ContainerRuntimeCreates a container for this module copy and its host. Server thread, after the service's own checks.- Specified by:
createin interfaceContainerRuntime
-
own
-
ownsContainer
-
attach
Description copied from interface:ContainerRuntimesessionnow showscontainer. Idempotent for a session/container pair. Server thread.- Specified by:
attachin interfaceContainerRuntime
-
detach
Description copied from interface:ContainerRuntimesessionno longer showscontainer. Must tolerate an absent or partially failed attach. If the container's owner is unloading, end through the unload path using the deadline supplied toContainerRuntime.prepareUnload(UiOwner, long), never through endWhenUnviewed. Server thread.- Specified by:
detachin interfaceContainerRuntime
-
engine
Description copied from interface:ContainerRuntimeThe engine that applies gestures to this runtime's containers.- Specified by:
enginein interfaceContainerRuntime
-
unloadWaitOverride
Shortens only the test budget, without replacing the service's absolute deadline. -
prepareUnload
Description copied from interface:ContainerRuntimeUnload step 2: freeze new work for this module copy and retain the shared absolute System.nanoTime deadline. All later detach/wait operations use that deadline, without restarting a timeout. Unloading thread.- Specified by:
prepareUnloadin interfaceContainerRuntime
-
startUnloadCommits
Description copied from interface:ContainerRuntimeUnload step 4: start changed COMMIT writes for this copy, reusing any write already in flight. Unloading thread.- Specified by:
startUnloadCommitsin interfaceContainerRuntime
-
finishUnload
Description copied from interface:ContainerRuntimeUnload step 6: await answers until the same deadline and end every container of this copy. Unloading thread.- Specified by:
finishUnloadin interfaceContainerRuntime
-
ended
-
forEachContainer
private static void forEachContainer(FrameworkContainerRuntime.OwnerContainers group, String step, Consumer<FrameworkSlotContainer> action)
-