|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.objectify.cache.TriggerFuture<T>
public abstract class TriggerFuture<T>
A Future> wrapper that executes an abstract method with the result at some point after the data becomes available. A "best effort" is made to ensure execution is made in a timely manner by hooking into the ApiProxy delegate system. Notification will happen ONCE:
To work, this future relies on the TriggerFutureHook. It must be installed on a per-thread basis at the beginning of a request and uninstalled at the end of a request. Typically this is done by the AsyncCacheFilter.
Field Summary | |
---|---|
protected java.util.concurrent.Future<T> |
raw
Wrap the raw Future> |
Constructor Summary | |
---|---|
TriggerFuture(java.util.concurrent.Future<T> raw)
Wrap a normal Future> |
Method Summary | |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
|
T |
get()
|
T |
get(long timeout,
java.util.concurrent.TimeUnit unit)
|
boolean |
isCancelled()
|
boolean |
isDone()
This version also checks to see if we are done and we still need to call the trigger. |
protected abstract void |
trigger()
This method will be called ONCE upon completion of the future, successful or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.concurrent.Future<T> raw
Constructor Detail |
---|
public TriggerFuture(java.util.concurrent.Future<T> raw)
Method Detail |
---|
protected abstract void trigger()
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<T>
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<T>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<T>
Future.isDone()
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |