开发者

How to code in GWT server side?

开发者 https://www.devze.com 2023-02-03 22:54 出处:网络
In GWT, I will use G chart to present data in the browser, in the gwt server side i will need one thread will generate random data, other threads will represent the data to the client(browser) in a ti

In GWT, I will use G chart to present data in the browser, in the gwt server side i will need one thread will generate random data, other threads will represent the data to the client(browser) in a timely manner say after every 2 sec(synchronously),How can i code in the server side ?? Any kind of help is appreciable.. Thanks in advanc开发者_C百科e


Writing code in the server side of GWT is really exactly the same as writing java code without GWT. In other words, once you get a hold of the data that the client sent inside your implementation of RemoteServiceServlet, then you are free to use whatever java code, libs, and/or frameworks to process that data.

From your description, it sounds like you need to kick off another thread to generate random data and then respond immediately to the client. You might want to read about creating new threads in java: http://download.oracle.com/javase/tutorial/essential/concurrency/.

There are several libraries that make it easier to run jobs. I'm familiar with quartz. You could use a scheduler like quartz to schedule a job that generates random data when the client requests? Or maybe it could just generate random data every so often?

From the client side, you'll probably want to poll every 2 seconds to check whether there is new data to display. Here'a another thread that gives some options for polling from gwt:

Client side Callback in GWT

  • Dave
0

精彩评论

暂无评论...
验证码 换一张
取 消