0

I am able to create threads however creation of a Timer and scheduling it are eluding me. I am unsure why this is failing...and silently!

Any ideas?

Brian Webster
  • 30,033
  • 48
  • 152
  • 225

1 Answers1

0

You can use threads in GAE, but there are limitations:

  1. You must create them via GAE provided ThreadManager.
  2. On frontend instances threads can not outlive requests. This means that Timer started from a http request can not run TimerTask if the request already ended - I guess this is why it silently fails.

If you need to start a delayed task, try using DeferredTask (here's an example) with ETA setting.

Community
  • 1
  • 1
Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • I already have threading abstractions in my application which for AppEngine servers create threads in this manner. I have exposed backend to user requests so this has nothing to do with frontend. Perhaps they aren't creating Timers using appropriate threading API...if there are no changes to JRE then I guess this is the case. – user2292134 Apr 17 '13 at 20:45
  • Dang...it appears Thread.sleep is a no-go...kind of hard to roll your own timer. I am not seeing option in queue classes for simulating scheduling of thread. – user2292134 Apr 17 '13 at 21:53