简体   繁体   English

GWT服务器端代码独立运行

[英]GWT Server side code running independently

Hy, I am writing a GWT app. 嗨,我在写GWT应用。 App consists of getting, storing and showing some informations. 应用程序包括获取,存储和显示一些信息。 On a client side I show information that I get from database using RPC calls. 在客户端,我显示了使用RPC调用从数据库中获取的信息。 Next, I have to fetch XML file from remote server, pars it and store data in database every 10 seconds. 接下来,我必须每隔10秒从远程服务器获取XML文件,对其进行解析并将数据存储在数据库中。 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? 有人对此有解决方案吗?

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! 我真的需要解决方案……谢谢!

If you use a full Java EE Application Server, you can use the Timer facilities from Java EE (see the Oracle Tutorial ). 如果使用完整的Java EE Application Server,则可以使用Java EE中的Timer功能(请参见Oracle教程 )。
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. 第三种解决方案是编写一个单独的批处理应用程序,然后通过cron作业触发该程序,或者将其作为守护程序运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM