Loreno, You'll not be able to start a thread inside the AppEngine, this is one of the limitations of the platform (fair enough I guess). And about use the memcache you might be careful because the AppEngine staff doesn't ensure that your data will be safe, it's said that you must never develop something using the memcache as the main mechanism to provide the wanted feature, use it as a performance improvement hook.
You must keep in mind that AppEngine isn't just about develop and deploy in the cloud, there is a philosophy inherent to it, you should spent less computacional power as possible, why don't you use the cron service to check in certain intervals instead of keeping a thread running wasting computional power? *Jayr Motta* Software Developer * * I'm on BlackBeltFactory.com<http://www.blackbeltfactory.com/ui#!User/jmotta/ref=jmotta> ! On Mon, Jun 27, 2011 at 3:13 PM, [email protected] < [email protected]> wrote: > Sounds promising... Should say that I didn't know about the backend service > so far. I'm starting with GAE, but with a non trivial problem, instead of a > hello world :-) > > Now I just need to be able to update my timers in a second by second > fashion (there are situations where I need to restart them). As far as I > could see, Thread.sleep( 1000 ) should not be a problem... > > Thanks for the advice Bruno! > > > On Mon, Jun 27, 2011 at 1:35 PM, Bruno Fuster <[email protected]>wrote: > >> 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. >> > > -- > 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.
