com.googlecode.objectify.cache
Class TriggerSuccessFuture<T>

java.lang.Object
  extended by com.googlecode.objectify.cache.TriggerFuture<T>
      extended by com.googlecode.objectify.cache.TriggerSuccessFuture<T>
All Implemented Interfaces:
java.util.concurrent.Future<T>

public abstract class TriggerSuccessFuture<T>
extends TriggerFuture<T>

Extends TriggerFuture so that it only gets triggered on successful (no exception) completion of the Future. This prevents, for example, cache put()s from firing when concurrency exceptions are thrown.

Author:
Jeff Schnitzer

Field Summary
 
Fields inherited from class com.googlecode.objectify.cache.TriggerFuture
raw
 
Constructor Summary
TriggerSuccessFuture(java.util.concurrent.Future<T> raw)
          Wrap a normal Future
 
Method Summary
protected abstract  void success(T result)
          This method will be called ONCE upon successful completion of the future.
protected  void trigger()
          This method will be called ONCE upon completion of the future, successful or not.
 
Methods inherited from class com.googlecode.objectify.cache.TriggerFuture
cancel, get, get, isCancelled, isDone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriggerSuccessFuture

public TriggerSuccessFuture(java.util.concurrent.Future<T> raw)
Wrap a normal Future

Method Detail

success

protected abstract void success(T result)
This method will be called ONCE upon successful completion of the future.


trigger

protected final void trigger()
Description copied from class: TriggerFuture
This method will be called ONCE upon completion of the future, successful or not. Beware that this.get() may throw an exception.

Specified by:
trigger in class TriggerFuture<T>


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