/** * Retrieves from the cache and returns the resource with the given location and * further attributes. If necessary, creates the resource by means of * {@link #createResource(Object...)} and stores it into the cache. * The cache key is a combination of the location and further attributes. * <p/> * This method MUST be re-entrant, its result MUST be thread-safe. * * @param params validator/transmogrifier parameters. * @return resource instance. * @throws Exception */ protected T resource(final Object... params) throws Exception { String key = resourceCacheKey(params); getCache().putIfAbsent(key, new Loader<T>() { @Override protected T load() throws RuntimeException { return createResource(params); } }); return getCache().get(key).get(); }