public class PendingFutures extends Object
This bit of appengine magic hooks into the ApiProxy and does the heavy lifting of making the TriggerFuture> work.
This class maintains a thread local list of all the outstanding Future> objects that have pending triggers. When a Future> is done and its trigger is executed, it is removed from the list. At various times (anytime an API call is made) the registered futures are checked for doneness and processed.
The AsyncCacheFilter is necessary to guarantee that any pending triggers are processed at the end of the request. A future GAE SDK which allows us to hook into the Future> creation process might make this extra Filter unnecessary.
Constructor and Description |
---|
PendingFutures() |
Modifier and Type | Method and Description |
---|---|
static void |
addPending(Future<?> future)
Register a pending Future that has a callback.
|
static void |
completeAllPendingFutures()
Iterate through all pending futures and get() them, forcing any callbacks to be called.
|
static void |
removePending(Future<?> future)
Deregister a pending Future that had a callback.
|
public static void addPending(Future<?> future)
future
- must have at least one callbackpublic static void removePending(Future<?> future)
public static void completeAllPendingFutures()
Copyright © 2014. All rights reserved.