can't quite apply this patch as
WHIRR-279 in progress.
I think the checkNull singleton pattern is a bit distracting. I prefer java enum singletons but not hard set on it.
Also, it might be cleaner to use the InputStreamMap or BlobMap in jclouds rather that this object. It is a view that supports containsKey() clear() etc, and could probably eliminate most of this code. Ideally, we could create a small function to make a concurrent map out of this, emulating putIfAbsent() with something like this
return map.put(key, value);
ex. ConcurrentMap<String, Blob> cache = makeConcurrentMap(deleteContainerOnShutdown(context.getBlobMap(createTempContainer())));
cache.clear()// deletes all blobs
you'd think that this would be very inefficient, as maps need to return the old value. However, since there is no old value (new container), the performance should be fine.