Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate hotswap support from the Hotswap Agent plugin #19261

Open
Artur- opened this issue Apr 26, 2024 · 1 comment
Open

Integrate hotswap support from the Hotswap Agent plugin #19261

Artur- opened this issue Apr 26, 2024 · 1 comment

Comments

@Artur-
Copy link
Member

Artur- commented Apr 26, 2024

Describe your motivation

The Hotswap agent plugin at https://github.com/HotswapProjects/HotswapAgent/tree/master/plugin/hotswap-agent-vaadin-plugin implements support for hot reloading of various parts of Flow but it has the issue that it tries to support all Flow versions at the same time, and that it is an external project so it is always lagging behind when Flow gets new features. As it tries to support many Flow versions, the code becomes quite complex.

Describe the solution you'd like

Implement the same approach already tested in Hilla here https://github.com/vaadin/hilla/blob/main/packages/java/endpoint/src/main/java/com/vaadin/hilla/Hotswapper.java#L34 and here https://github.com/vaadin/hilla/blob/main/packages/java/hilla-dev/src/main/java/com/vaadin/hilla/devmode/hotswapagent/HillaPlugin.java

In other words, make the Hotswap Agent plugin call a Flow method when hotswapping has taken place without doing any filtering or trying to figure out what needs to be done. Let the onHotswap method in Flow decide what needs to be done due to reloading of the given class(es).

This would have many benefits:

  1. The Hotswap Agent plugin does not need to support multiple Flow versions. It only needs to find onHotswap and different Flow versions can implement the method in different ways
  2. There is no need for strange reflection code to clear caches etc. The code in onHotswap will become much simpler than what is in the hotswap agent plugin
  3. The JRebel plugin can use the same method so that hotswapping will work equally well regardless of which product you use
@mshabarov
Copy link
Contributor

mshabarov commented May 8, 2024

Acceptance Criteria:

  • Flow has an API for updating routes, its implementation does the same as the existing logic does in hotswap-agent-vaadin-plugin - 3 SP
  • Platform (or Hilla, or Flow, should be checked which is better) has one single public method onHotswap that is called from hotswap-agent-vaadin-plugin
  • Vaadin's onHotswap method implementation delegates to corresponding hot swap methods in Flow and Hilla, depending on what is used in a project. - 5 SP (includes the previous point)
  • hotswap-agent-vaadin-plugin has still VaadinIntegration class, but the logic in there is called only if the onHotswap method is not found in Vaadin, otherwise the plugin does nothing, just calls the onHotswap method. This is needed for backwards compatibility between further versions of HA plugin and older Vaadin versions (before 24.5) - 5 SP
  • Hilla's HA plugin HillaPlugin is removed (basically remove the whole module hilla-dev) - 3 SP

Let's not pick these changes to older maintained Vaadin branches. If this feature will be needed for older Vaadin versions or requested by Customers, let's do it, otherwise ignore it for now and let VaadinIntegration class do the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🟢Ready to Go
Development

No branches or pull requests

2 participants