0

The GWT timer I use in my application doesn't seem to respond to a call to cancel().

I see new server calls being fired, even after cancel() is reached.

com.google.gwt.user.client.Timer t = new com.google.gwt.user.client.Timer() {
                            @Override
                            public void run() {
                                myService.poll(result.getKey(), new HappyAsyncCallback<JobResult>() {
                                    @Override
                                    public void onSuccess(JobResult result) {
                                        if (result.getUuid() != null && !result.getUuid().isEmpty()) {
                                            Window.alert("Done! Cancelling...");
                                            cancel();
                                        }
                                    }
                                });
                            }
                        };
                        t.scheduleRepeating(5000);

I read these similar issues, but haven't been able to use these issues to my advantage unfortunately.

GWT Timer cancel not working

Can't cancel repeat timer in GWT

Community
  • 1
  • 1
Julius
  • 2,784
  • 6
  • 32
  • 54

1 Answers1

0

I have been fooled by my own application here. We are doing a really lengthy batch process on the server and during this process the Timer will fire multiple calls to poll(). When the cancel() method is reached, these calls are still returning from the server :) Thanks for your suggestions, Manolo.

Julius
  • 2,784
  • 6
  • 32
  • 54