Are you sure this is what you want?

while(!stop)
{
  // without the alert all this stuff happens bazillion times each second
  schedule(1000*10);
  entryPoint.refreshData();
}

I'm not sure whether Timer likes to get scheduled again before it reached
its first timeout.
Also it looks like you might be interested in Timer.scheduleRepeating()
and Timer.cancel();

On Fri, Jul 9, 2010 at 12:52 AM, ccg123 <tks...@gmail.com> wrote:

> Why does the timer below get triggered every second, popping up the
> alert and crashing the browser? I expect it to be triggered every 10
> seconds:
>
> public class AlertEntryPoint implements EntryPoint {
>
>        Map<Integer, List<AlertDTO>> alertGroupByTypeDTOs = new
> TreeMap<Integer, List<AlertDTO>>();
>        List locationsInfoDTOList = new ArrayList<LocationsInfoDTO>();
>
>        static class AlertTimer extends Timer {
>                AlertEntryPoint entryPoint = null;
>                public AlertTimer(AlertEntryPoint alertEntryPoint) {
>                        entryPoint = alertEntryPoint;
>                }
>
>                boolean stop;
>                @Override
>                public void run() {
>                        while (!stop) {
>                                schedule(1000 * 10);
>
>                                entryPoint.refreshData();
>
>                                 Window.alert("Somebody started me");
>                        }
>
>                }
>
>        }
>
>        @Override
>        public void onModuleLoad() {
>                //refreshData();
>
>                AlertEntryPoint.AlertTimer timer = new AlertTimer(this);
>                timer.run();
>        }
> .
> .
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to