There is no such thing as "background process" in Google Web Toolkit client, because... it is a 
client part. So you can not do threads, can not do daemons, since it supposed to be cross-compiled to JavaScript and run in a browser 
pretty ugly way. However, you can repeatedly call the same function. In JavaScript it is timeout. But you want to avoid JSNI for this. Hence, do the following: use a 
com.google.gwt.user.client.Timer. If you want call it periodically each 5 seconds, you can do something like this:
private void updaterProcess() {
  Timer timer = new Timer() {
       @Override
       public void run() {
           // call stuff here
       }
  };
  timer.scheduleRepeating(5000);
}
 
No comments:
Post a Comment