All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.objectify.cache.TriggerSuccessFuture Maven / Gradle / Ivy

Go to download

*** 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); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy