Interface LocalInvocationProcessor
public interface LocalInvocationProcessor
Implements the strategy by which the
Invocation
is dispatched to the local Object
in memory.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
If theMethod
called from theInvocation
returns aFuture
instance, this may defined a strategy for handling the result. -
Method Summary
Modifier and TypeMethodDescriptionReturns an instance ofLocalInvocationProcessor.ReturnValueStrategy
which simply blocks until theFuture
either returns or throws an instance ofThrowable
.Constructs aLocalInvocationProcessor.ReturnValueStrategy
which ignores the return value and immediately returns anInvocationResult
with a null result.void
processInvocation
(Object target, Invocation invocation, Consumer<InvocationResult> syncInvocationResultConsumer, Consumer<InvocationError> syncInvocationErrorConsumer, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, Consumer<InvocationError> asyncInvocationErrorConsumer) Performs the dispatch to the supplied object.Constructs aLocalInvocationProcessor.ReturnValueStrategy
which simply hands the result of theInvocation
directly to a new instance ofInvocationResult
and passes it into to the suppliedConsumer
-
Method Details
-
processInvocation
void processInvocation(Object target, Invocation invocation, Consumer<InvocationResult> syncInvocationResultConsumer, Consumer<InvocationError> syncInvocationErrorConsumer, List<Consumer<InvocationResult>> asyncInvocationResultConsumerList, Consumer<InvocationError> asyncInvocationErrorConsumer) Performs the dispatch to the supplied object. Catching and collecting any errors appropriately, and forwarding the result to the suppliedConsumer
. This should not throw an exception, ever.- Parameters:
target
-invocation
-asyncInvocationResultConsumerList
-asyncInvocationErrorConsumer
-
-
ignoreReturnValueStrategy
Constructs aLocalInvocationProcessor.ReturnValueStrategy
which ignores the return value and immediately returns anInvocationResult
with a null result.- Returns:
- the
LocalInvocationProcessor.ReturnValueStrategy
which passes the result through.
-
simpleReturnValueStrategy
Constructs aLocalInvocationProcessor.ReturnValueStrategy
which simply hands the result of theInvocation
directly to a new instance ofInvocationResult
and passes it into to the suppliedConsumer
- Returns:
- the
LocalInvocationProcessor.ReturnValueStrategy
which passes the result through.
-
blockingFutureStrategy
Returns an instance ofLocalInvocationProcessor.ReturnValueStrategy
which simply blocks until theFuture
either returns or throws an instance ofThrowable
.- Returns:
- the
LocalInvocationProcessor.ReturnValueStrategy
which blocks until the future finishes
-