Interface RPCHandler
- All Superinterfaces:
RPCProvider
- All Known Implementing Classes:
DefaultRPCHandler
A handler for any rpc invocation happening on the network. Every handler is bound to a specific class and optionally
its instance it is handling. If the instance is not given, the handler is a placeholder which is only working with
the result of the previous method calls in chained rpc calls.
- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents the result of a method invocation with rpc. -
Method Summary
Modifier and TypeMethodDescriptionhandle(@NonNull RPCInvocationContext context) Handles the given rpc context using the information of this handler.voidregisterTo(@NonNull RPCHandlerRegistry registry) Registers this rpc handler to the given rpc handler registry.Methods inherited from interface eu.cloudnetservice.driver.network.rpc.RPCProvider
dataBufFactory, objectMapper, targetClass
-
Method Details
-
registerTo
Registers this rpc handler to the given rpc handler registry.- Parameters:
registry- the registry to register to.- Throws:
NullPointerException- if the given registry is null.
-
handle
Handles the given rpc context using the information of this handler. A handler must respect all settings set in the context. The handler decides whether it can handle the request based on the information provided through the context. If the instance use is set to strict in the context (or this handler has no instance set since construction) and no instance is provided through the context, the handler should return a successful result containing either null or the default primitive value based on the return value of the target method (if normalize primitives is set to true in the context). If an exception happens during the post of the rpc to the underlying method the result should be a failure containing as its result the thrown exception.- Parameters:
context- the context of the handler invocation.- Returns:
- the result of the handler execution.
- Throws:
NullPointerException- if the given context is null.
-