I’m a bit confused by the documentation for Java DeferredTask. I’ve read the Python documentation here: http://code.google.com/appengine/articles/deferred.html but I’m unclear on exactly how I’d use the Java version.
Can you provide working sample code that launches a DeferredTask to do a simple write using a DatastoreService?
To use deferred, you first have to define a class that contains the code you want to run:
Just like any other serializable class, you can have locals that store relevant information about the task. Then, to run the task, instantiate an instance of your class and pass it to the task queue API:
You can even use anonymous inner classes for your tasks, but beware of the caveats described in the note here.