GWT服务器端代码独立运行

时间:2022-04-17 03:48:50

Hy, I am writing a GWT app. App consists of getting, storing and showing some informations. On a client side I show information that I get from database using RPC calls. Next, I have to fetch XML file from remote server, pars it and store data in database every 10 seconds. I have to do that on server side without interacting with client side so that would be running even if no one is browsing the app. Does anyone have a solution for this?

Hy,我正在写一个GWT应用程序。应用程序包括获取,存储和显示一些信息。在客户端,我显示了使用RPC调用从数据库获取的信息。接下来,我必须从远程服务器获取XML文件,对其进行解析并每隔10秒将数据存储在数据库中。我必须在服务器端执行此操作而不与客户端进行交互,以便即使没有人正在浏览应用程序也会运行。有人有解决方案吗?

I tried to solve this with calling the method, that is fetching, parsing and storing data, from client side every 10s with timer but that doesn't work because this will work only if someone is looking at the app in the browser at the moment, but if no one is browsing it for a month, data from remote server won't be fetched and stored for a month and that is a problem.....

我尝试通过调用方法来解决这个问题,即每隔10秒从客户端调用获取,解析和存储数据,但这不起作用,因为只有当有人在浏览器中查看应用程序时才会起作用,但如果没有人浏览它一个月,远程服务器的数据将不会被提取和存储一个月,这是一个问题.....

I really need solution...Thanks in advance!

我真的需要解决方案......提前谢谢!

1 个解决方案

#1


0  

If you use a full Java EE Application Server, you can use the Timer facilities from Java EE (see the Oracle Tutorial).
Otherwise you could look if your server has some proprietary solutions for this. A third solution would be writing a separate batch application and trigger that via cron job or running it as a daemon.

如果使用完整的Java EE Application Server,则可以使用Java EE中的Timer工具(请参阅Oracle教程)。否则,您可以查看您的服务器是否有一些专有的解决方案。第三种解决方案是编写一个单独的批处理应用程序,并通过cron作业或作为守护程序运行它。

#1


0  

If you use a full Java EE Application Server, you can use the Timer facilities from Java EE (see the Oracle Tutorial).
Otherwise you could look if your server has some proprietary solutions for this. A third solution would be writing a separate batch application and trigger that via cron job or running it as a daemon.

如果使用完整的Java EE Application Server,则可以使用Java EE中的Timer工具(请参阅Oracle教程)。否则,您可以查看您的服务器是否有一些专有的解决方案。第三种解决方案是编写一个单独的批处理应用程序,并通过cron作业或作为守护程序运行它。