aloo aloo - 4 months ago 30
Java Question

Make objecitfy supress memcache exceptions

I'm using objectify's

annotations on my entities. Obviously, this means that any time I do a PUT on my entity, it also writes it to memcache. However, recently, I've seen memcache go down on appengine and as a result objectify fails to write the entitiy to memcache (writes to datastore fine).

In this failure however, objectify throws the memcache exception - specifically: Memcache put: Set failed to set 1 keys:

Is there a way to get objectify to NOT throw these exceptions? They are relatively harmless and I don't want to add try/catches everywhere....


This is actually a known problem with the MemcacheService implementation. By default it is supposed to use the LogAndContinueErrorHandler, which is only supposed to log the error and then continue harmlessly.

Unfortunately, when the async API was implemented in the Memcache Service, they mistakenly broke the use of the error handlers - there is an open issue in the GAE issue tracker here which you can star.

This therefore leaves you with two options - edit the source of Objectify, and catch/ignore all of the exceptions before they get to you, or wait for the fix to the underlying MemcacheService implementation in the GAE SDK.