Interface RpcInvocationListener
- All Superinterfaces:
Serializable
@ClientCallable method is consuming the time spent holding the
session lock while processing a request).
A single client request typically carries several invocations; the listener
is notified once per invocation. invocationStarted(com.vaadin.flow.server.communication.RpcInvocationEvent),
invocationFailed(com.vaadin.flow.server.communication.RpcInvocationEvent, java.lang.Throwable) (only when the handler threw) and
invocationEnded(com.vaadin.flow.server.communication.RpcInvocationEvent) for one invocation are delivered on the same thread,
in that order, with invocationEnded always delivered after
invocationStarted regardless of outcome, so a listener may keep
timing state in a ThreadLocal. See AbstractRpcInvocationEvent
for which invocations are reported, what a synchronized property update
reports, and how the notifications of concurrent requests relate.
Implementations must be fast and non-blocking: callbacks run on the request thread directly around invocation handling. Exceptions thrown from a callback are logged and suppressed so they cannot disrupt RPC processing.
Register via
VaadinService.addRpcInvocationListener(RpcInvocationListener),
typically from a VaadinServiceInitListener.
- Since:
- 25.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidDeprecated, for removal: This API element is subject to removal in a future version.Invoked on the request thread once an RPC invocation has been handled, whether it completed normally or threw.default voidinvocationFailed(RpcInvocationEvent event, Throwable error) Deprecated, for removal: This API element is subject to removal in a future version.Invoked on the request thread when handling an invocation threw, beforeinvocationEnded(com.vaadin.flow.server.communication.RpcInvocationEvent).default voidDeprecated, for removal: This API element is subject to removal in a future version.Invoked on the request thread immediately before an RPC invocation is handled.
-
Method Details
-
invocationStarted
Deprecated, for removal: This API element is subject to removal in a future version.Invoked on the request thread immediately before an RPC invocation is handled.- Parameters:
event- the invocation event
-
invocationFailed
Deprecated, for removal: This API element is subject to removal in a future version.Invoked on the request thread when handling an invocation threw, beforeinvocationEnded(com.vaadin.flow.server.communication.RpcInvocationEvent). The framework routes the throwable to the session error handler independently of this callback.- Parameters:
event- the invocation eventerror- the throwable raised by the invocation handler
-
invocationEnded
Deprecated, for removal: This API element is subject to removal in a future version.Invoked on the request thread once an RPC invocation has been handled, whether it completed normally or threw.- Parameters:
event- the invocation event
-
RpcInvocationStartedEvent,RpcInvocationFailedEventandRpcInvocationEndedEventon theservice event businstead. The callbacks of this listener are served by those events, one instance each, so an implementation that correlates the callbacks of an invocation has to do so through the thread they are delivered on rather than through the identity of the event