0

I developed a java application with a JavaFX8 GUI. the program runs continuously (for long periods) collecting data,processing it and writing to the DB etc. configuration and oversight of the program are through the GUI.

I would like to be able to see/control the application from any computer with a browser. would Vaadin be a good way to do that (any alternatives that are easier?) ? I have tried some to adapt some Vaadin examples and have not managed to get my program running continuously regardless of what user connects/disconnects to the web service? does it depend on what server is running Vaadin? I am currently using the Jetty (in eclipse with the Vaadin plugin)

I have been writing code in java for a few years but have very little experience in server-client code

Thank you

Jona m
  • 1
  • 1
  • 3
    It depends. If Your GUI app is designed with layers, separation (etc), conversion is possible. But when this is 'spagetti code' over GUI events, not so easy – Jacek Cz May 04 '17 at 11:26
  • It also depends on your original idea of the app's architecture and what you mean by `controlling the application` and `running continuously, collecting data, processing`. Additionally, you should probably distinguish between 2 concepts here: web-app (aka UI) which will have its own (let's call it) _instance_ for every user accessing it, and the collector side of the app which you probably want to be a _singleton_ collection of services or whatever that can be stopped, started, reconfigured by any user without affecting the web-app. – Morfic May 04 '17 at 12:23

1 Answers1

0

I think that Vaadin would be a good option for you. I've developed few applications with this framework to display some real time charts on SmartTV's web browser.

Most likely your session times out due to inactivity. That's implemented by default on Vaadin but in can be annoying in these type of applications.

With the snippet below (which should be lying in your UI) the webapp will reload automatically when the session expires:

@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
public static class MyUIServlet extends VaadinServlet implements Serializable {

    @Override
    protected void servletInitialized() throws ServletException {
        super.servletInitialized();
        getService().setSystemMessagesProvider((systemMessagesInfo) -> {
            CustomizedSystemMessages messages
                    = new CustomizedSystemMessages();

            messages.setSessionExpiredNotificationEnabled(false);

            return messages;
        });

    }
}

Also, refer to this question: Setting Vaadin session-timeout parameter

I'd recommend you to use the Spring integration which will allow you to wire easily all the dependencies, use Spring Data to access the database in a simple way and the @Scheduled annotation that will be useful to run some background tasks and processing.

Community
  • 1
  • 1
Alex Roig
  • 1,534
  • 12
  • 18