Limits of Vaadin UI State Restoration After Session Failover
0 reputation · 11 Apr 2024, 21:57 UTC
Goal
Determine if Vaadin Flow re‑executes UI initialization listeners such as @PostConstruct methods or UIInitListener implementations after a session is passivated, replicated to a backup node, and restored following a failover.
Constraints and uncertainty
- The UI class and all its fields must be serializable for HTTP session replication to succeed.
- Session replication must be configured (e.g., Tomcat clustering with a FileStore or JDBC store).
- Vaadin documentation guarantees automatic re‑attachment of the UI and restoration of component values, but it does not specify whether the UI construction phase (including init listeners) runs again on the restored instance.
Understanding this behavior is important because re‑running initialization logic could cause duplicate side‑effects such as re‑registering event listeners, re‑initializing services, or resetting state that should persist across failover.
Based on the current documentation, the following questions remain unresolved:
- Are @PostConstruct methods and UIInitListener callbacks invoked again on the restored UI after session failover?
- If they are not invoked, how does Vaadin preserve the UI instance state without re‑executing the initialization code?