Package com.ultikits.ultitools.websocket
Class PanelResponderRegistry.Invocation
java.lang.Object
com.ultikits.ultitools.websocket.PanelResponderRegistry.Invocation
- All Implemented Interfaces:
Runnable
- Enclosing class:
PanelResponderRegistry
One admitted request: the responder entry captured at admission, its deadline and its
outcome. Runs on a worker; every settlement goes through
settle(com.google.gson.JsonElement, java.lang.Throwable).-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassLoaderThe admitting thread's context class loader, installed for the call.private final UltiToolsPluginThis registry's registration scope on the admitting thread, possiblynull.private final AtomicBooleanSet by whichever comes first: a worker starting the call, or a settlement before it started.private final com.google.gson.JsonObjectprivate ScheduledFuture<?> private final AtomicBooleanprivate final PanelResponderRegistry.ResponderEntryprivate final Stringprivate final CompletableFuture<com.google.gson.JsonElement> private final RunnableRuns once when the module's work ends; seePanelResponderRegistry.dispatch(String, JsonObject, String, Runnable). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateInvocation(String messageType, PanelResponderRegistry.ResponderEntry entry, com.google.gson.JsonObject data, CompletableFuture<com.google.gson.JsonElement> outcome, Runnable workEnded) -
Method Summary
Modifier and TypeMethodDescriptionprivate CompletableFuture<? extends com.google.gson.JsonElement> Calls the responder at the framework's boundary to module code: whatever the call throws becomes this request's outcome instead of being lost in the worker.private voidendWork()RunsworkEndedonce.private voidexpire()The deadline action: take a not-yet-started invocation back, then fail the outcome.private voidinstallScope(UltiToolsPlugin scope) Sets this registry's registration scope on the current thread;nullremoves it.private RejectedExecutionExceptionrefusal()private voidrelease()The completion hook: frees the queue slot and the deadline, and stops tracking.voidrun()private voidThe one settle path.private RejectedExecutionException
-
Field Details
-
messageType
-
entry
-
data
private final com.google.gson.JsonObject data -
outcome
-
admittingLoader
The admitting thread's context class loader, installed for the call. -
admittingScope
This registry's registration scope on the admitting thread, possiblynull. -
deadline
-
workEnded
Runs once when the module's work ends; seePanelResponderRegistry.dispatch(String, JsonObject, String, Runnable). -
claimed
Set by whichever comes first: a worker starting the call, or a settlement before it started. -
ended
-
-
Constructor Details
-
Invocation
private Invocation(String messageType, PanelResponderRegistry.ResponderEntry entry, com.google.gson.JsonObject data, CompletableFuture<com.google.gson.JsonElement> outcome, Runnable workEnded)
-
-
Method Details
-
run
public void run() -
endWork
private void endWork()RunsworkEndedonce. -
callResponder
Calls the responder at the framework's boundary to module code: whatever the call throws becomes this request's outcome instead of being lost in the worker. Returnsnullwhen the outcome is already settled here. -
installScope
Sets this registry's registration scope on the current thread;nullremoves it. -
release
private void release()The completion hook: frees the queue slot and the deadline, and stops tracking. -
refusal
-
shutDownFailure
-
expire
private void expire()The deadline action: take a not-yet-started invocation back, then fail the outcome. -
settle
The one settle path. Cancels the deadline before completing the outcome: aCompletableFutureruns later-registered dependents first, so a caller waiting on the outcome must find the deadline already gone. A second settlement is a no-op.
-