Product Documentation : Ehcache Developer Guide : Write-Through and Write-Behind Caches : Handling Exceptions that Occur After a Writer is Called
Handling Exceptions that Occur After a Writer is Called
Once all retry attempts have been executed, on exception the element (or all elements of that batch) will be passed to the net.sf.ehcache.writer.CacheWriter#throwAway() method. The user can then act one last time on the element that failed to write.
A reference to the last thrown RuntimeException, and the type of operation that failed to execute for the element, are received. Any Exception thrown from that method will simply be logged and ignored. The element will be lost forever. It is important that implementers are careful about proper Exception handling in that last method.
A handy pattern is to use an eternal cache (potentially using a writer, so it is persistent) to store failed operations and their element. Users can monitor that cache and manually intervene on those errors at a later point.
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback