This looks like a clean backport of
The only point worth addressing in this patch is the synchronization on refcount is inconsistent. Sometimes only the lock on cachedArchives is held, at other points only the lock on the CacheStatus instance is held. I found no cases of inconsistent lock ordering (no deadlocks), but it appears possible to get stale values for refcount. Since it's only incremented while holding the lock on cachedArchives, one can only get false negatives for adding entries to the deletion queue (i.e. one may hold onto a cached entry longer than necessary, but one will never delete an entry in use by an initializing/running task). It's not a bad bug, but it's probably worth fixing.
+1 otherwise, particularly with the pending work in
MAPREDUCE-2495 and MAPREDUCE-2494.