Class SynchronizedRequestHandler

java.lang.Object
com.vaadin.flow.server.SynchronizedRequestHandler
All Implemented Interfaces:
RequestHandler, Serializable
Direct Known Subclasses:
BootstrapHandler, HeartbeatHandler, UidlRequestHandler

public abstract class SynchronizedRequestHandler extends Object implements RequestHandler
RequestHandler which takes care of locking and unlocking of the VaadinSession automatically. The session is locked before synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse) is called and unlocked after it has completed.

The current instances, such as the current UI, are restored to what they were before locking right after the session is unlocked, so the handler can set the current UI for the work it does with the lock held, and nothing that runs after the unlock sees that UI as current. If the handler or its SynchronizedRequestHandler.ResponseWriter throws, the UI the handler left current is made current again while the session ErrorHandler and the request interceptors handle the exception, with the session locked. For this, an exception thrown while a UI is current leaves handleRequest(VaadinSession, VaadinRequest, VaadinResponse) wrapped in a FailedUIRequestException that VaadinService unwraps.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Field Details

  • Constructor Details

    • SynchronizedRequestHandler

      public SynchronizedRequestHandler()
  • Method Details