Class StatefulHandler.StatefulHandlerInvoker
java.lang.Object
io.fluxzero.common.handling.HandlerInvoker.DelegatingHandlerInvoker
io.fluxzero.sdk.tracking.handling.StatefulHandler.StatefulHandlerInvoker
- All Implemented Interfaces:
HandlerInvoker
- Enclosing class:
StatefulHandler
protected class StatefulHandler.StatefulHandlerInvoker
extends HandlerInvoker.DelegatingHandlerInvoker
-
Nested Class Summary
Nested classes/interfaces inherited from interface HandlerInvoker
HandlerInvoker.DelegatingHandlerInvoker, HandlerInvoker.SimpleInvoker -
Field Summary
Fields inherited from class HandlerInvoker.DelegatingHandlerInvoker
delegate -
Constructor Summary
ConstructorsConstructorDescriptionStatefulHandlerInvoker(HandlerInvoker delegate, Entry<?> currentEntry, DeserializingMessage message) -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectprotected voidhandleResult(Object result) Applies stateful persistence semantics to a handler invocation result.invoke(BiFunction<Object, Object, Object> combiner) Invokes the handler and combines results using the given combiner function.protected ObjecttryStoreResult(Object result) Stores a result object if it is assignable to the stateful handler type.Methods inherited from class HandlerInvoker.DelegatingHandlerInvoker
expectResult, getMethod, getMethodAnnotation, getTargetClass, isPassive, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface HandlerInvoker
andFinally, invoke
-
Constructor Details
-
StatefulHandlerInvoker
public StatefulHandlerInvoker(HandlerInvoker delegate, Entry<?> currentEntry, DeserializingMessage message)
-
-
Method Details
-
invoke
Description copied from interface:HandlerInvokerInvokes the handler and combines results using the given combiner function. Used when aggregating results from multiple invokers (e.g.HandlerInvoker.join(List)).- Parameters:
combiner- function to combine multiple results- Returns:
- the combined result
-
handleResult
Applies stateful persistence semantics to a handler invocation result.Supported result forms:
Collection<?>: stores every same-type instance in the collection. If the collection is empty, the current entry is deleted. If the current entry ID is not part of returned IDs, the current entry is deleted.null: deletes the current entry only when the invoked method is expected to return handler state (same/assignable handler type).- Single object: stores it only if it is assignable to the handler type. If the stored ID differs from the current ID, the current entry is deleted (replacement behavior).
-
tryStoreResult
-
computeId
-