Right... I'm not sure but you could use the increment method from MemcacheService to atomically update this value each second from a single machine (backends) and read that from your dynamic instances constantly using ajax.
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/memcache/MemcacheService.html#increment(java.lang.Object, long) On Mon, Jun 27, 2011 at 1:08 PM, [email protected] < [email protected]> wrote: > I thought on this, but I think this works fine only if I have just one > running copy of my application. If I have two or more (because the workload > can be high), they can be out of sync regarding their local clocks. Thus, > requests that arrive at approximately the same time at the different > instances, can get a different value to the "second" variable... > > > > On Mon, Jun 27, 2011 at 12:58 PM, Bruno Fuster <[email protected]>wrote: > >> You could just put this countdown date into your cache (or even a static >> property if it won't change) and calculate the seconds easily using >> jodatime >> >> int seconds = Seconds.secondsBetween(new DateTime(), >> cache.get(countdownDate)).getSeconds(); >> >> After that, use javascript intervals to recalculate the countdown while >> the user is at your page instead of consuming some services on your >> back-end. >> >> >> >> >> On Mon, Jun 27, 2011 at 12:48 PM, [email protected] < >> [email protected]> wrote: >> >>> Is it possible to implement a global count down timer in GAE/J? I would >>> like an unique timer to be shared among all the application instances. The >>> precision of the timer is seconds. >>> >>> Any idea? >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Google App Engine for Java" group. >>> To post to this group, send email to >>> [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/google-appengine-java?hl=en. >>> >> >> >> >> -- >> Bruno Fuster >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine for Java" group. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-appengine-java?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > -- Bruno Fuster -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
