MPR Flow and Vaadin 7 with VaadinSession, VaadinServlet, and VaadinService

I have a bunch of calls to Vaadin 7 VaadinSession.getCurrent(), VaadinServlet.getCurrent(), and VaadinService.getCurrent(). What seems to be happening in many cases, if I catch things at the wrong time, is that “getCurrent” is returning null. The Tutorial does not really say to convert these, but I am wondering if, because we use “getCurrent”, we have to convert all these to using the corresponding “Flow” version. Is that a correct understanding and expectation?

The Tutorial does not really say to convert these, but I am wondering if, because we use “getCurrent”, we have to convert all these to using the corresponding “Flow” version.

In most cases you should use Flow version, since it is Flow servlet that takes over the control.

Also there is some change after Vaadin 7 (already in Vaadin 8) that these getCurrent() calls are returning always null when called from background thread.

Thanks. In my case, it was trivial to just change everything to flow for these 3 classes. But, as a follow-up, mostly for other users:

  1. When would you NOT want to?
  2. When could you keep the Vaadin 7 or Vaadin 8 version?

I ask because in the only section that mentions these things, https://vaadin.com/docs/v13/mpr/configuration/session.html, it gives the impression that, at least in some cases, you can keep using the Vaadin 7 or Vaadin 8 version because they use the same underlying Http stuff.

Thanks again.