com.googlecode.objectify.cache.TriggerSuccessFuture Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of objectify Show documentation
Show all versions of objectify Show documentation
*** THIS VERSION UPLOADED FOR USE WITH CEDAR-COMMON, TO AVOID DEPENDENCIES ON GOOGLE CODE-BASED MAVEN REPOSITORIES. *** The simplest convenient interface to the Google App Engine datastore
The newest version!
package com.googlecode.objectify.cache;
import java.util.concurrent.Future;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* 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
*/
abstract public class TriggerSuccessFuture extends TriggerFuture
{
private static final Logger log = Logger.getLogger(TriggerSuccessFuture.class.getName());
/** Wrap a normal Future */
public TriggerSuccessFuture(Future raw)
{
super(raw);
}
/**
* This method will be called ONCE upon successful completion of the future.
*/
abstract protected void success(T result);
/* (non-Javadoc)
* @see com.googlecode.objectify.cache.NotifyFuture#execute()
*/
protected final void trigger()
{
try {
this.success(this.get());
} catch (Exception ex) {
log.log(Level.WARNING, "Future threw an exception during trigger", ex);
}
}
}