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

4

1 回答 1

0

我在这里被自己的应用程序愚弄了。我们在服务器上执行了一个非常长的批处理过程,在此过程中,计时器将触发对 poll() 的多次调用。当到达 cancel() 方法时,这些调用仍然从服务器返回 :) 感谢您的建议,Manolo。

于 2013-07-17T12:30:50.763 回答