Code example for MapMaker

0
  private final ConventionBundleSource _underlying;
  private final CacheManager _cacheManager;
 
  private final Cache _conventionCache; 
 
  private final ConcurrentMap<Object, ConventionBundle> _frontCache = new MapMaker().weakValues().makeMap();
 
  public EHCachingConventionBundleSource(final ConventionBundleSource underlying, final CacheManager cacheManager) {
    ArgumentChecker.notNull(underlying, "underlying");
    ArgumentChecker.notNull(cacheManager, "cacheManager");
    _underlying = underlying;
    _cacheManager = cacheManager;
    EHCacheUtils.addCache(cacheManager, CONVENTION_CACHE_NAME);
    _conventionCache = EHCacheUtils.getCacheFromManager(cacheManager, CONVENTION_CACHE_NAME);
  } 
 
  protected ConventionBundleSource getUnderlying() { 
    return _underlying;
  }