com.googlecode.objectify.cache
Class Pending

java.lang.Object
  extended by com.googlecode.objectify.cache.Pending

public class Pending
extends java.lang.Object

This is the state maintained on a per-thread basis for all of the oustanding Future objects that have pending callbacks. When a Future is done and its callbacks are 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 callbacks 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.

Author:
Jeff Schnitzer

Constructor Summary
Pending()
           
 
Method Summary
 void add(java.util.concurrent.Future<?> future)
          Register a pending Future that has a callback.
 void checkPendingFutures()
          If any futures are pending, check if they are done.
 void completeAllPendingFutures()
          Iterate through all pending futures and get() them, forcing any callbacks to be called.
 boolean isEmpty()
           
 void remove(java.util.concurrent.Future<?> future)
          De-register a pending Future.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pending

public Pending()
Method Detail

add

public void add(java.util.concurrent.Future<?> future)
Register a pending Future that has a callback.

Parameters:
future - must have at least one callback

remove

public void remove(java.util.concurrent.Future<?> future)
De-register a pending Future.


isEmpty

public boolean isEmpty()
Returns:
true if there are no more pending futures.

checkPendingFutures

public void checkPendingFutures()
If any futures are pending, check if they are done. This will process their callbacks.


completeAllPendingFutures

public void completeAllPendingFutures()
Iterate through all pending futures and get() them, forcing any callbacks to be called.



Copyright © 2011 Jeff Schnitzer and a gang of pirates. All Rights Reserved. Build version: 3.1