/** * Constructs an instance making use of the default cache. * * @param factory The factory to cache. Can not be {@code null}. */ protected AbstractAuthorityMediator(int priority, Hints hints) { this(priority, ObjectCaches.create(hints), ReferencingFactoryContainer.instance(hints)); // configurable behaviour poolConfig.minIdle = Hints.AUTHORITY_MIN_IDLE.toValue(hints); poolConfig.maxIdle = Hints.AUTHORITY_MAX_IDLE.toValue(hints); poolConfig.maxActive = Hints.AUTHORITY_MAX_ACTIVE.toValue(hints); poolConfig.minEvictableIdleTimeMillis = Hints.AUTHORITY_MIN_EVICT_IDLETIME.toValue(hints); poolConfig.softMinEvictableIdleTimeMillis = Hints.AUTHORITY_SOFTMIN_EVICT_IDLETIME.toValue(hints); poolConfig.timeBetweenEvictionRunsMillis = Hints.AUTHORITY_TIME_BETWEEN_EVICTION_RUNS.toValue(hints); // static behaviour poolConfig.maxWait = -1; // block indefinitely until a worker is available poolConfig.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; }
/** Utility method used to produce cache based on provide Hint */ public static ObjectCache create(Hints hints) throws FactoryRegistryException { if (hints == null) hints = GeoTools.getDefaultHints(); String policy = (String) hints.get(Hints.CACHE_POLICY); int limit = Hints.CACHE_LIMIT.toValue(hints); return create(policy, limit); } /**