henrib commented on code in PR #4194: URL: https://github.com/apache/hive/pull/4194#discussion_r1177647457
########## standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/properties/SoftCache.java: ########## @@ -0,0 +1,239 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hive.metastore.properties; + +import java.lang.ref.SoftReference; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.function.BiFunction; +import java.util.function.Function; + +/** + * A soft referenced cache. + * <p> + * The actual cache is held through a soft reference, allowing it to be GCed under memory pressure.</p> + * <p> + * This class is <em>not</em> thread-safe.</p> + * @param <K> the cache key entry type + * @param <V> the cache key value type + */ +public class SoftCache<K, V> { + /** The default cache capacity. */ + private static final int CACHE_CAPACITY = 64; + /** The default cache load factor. */ + private static final float LOAD_FACTOR = 0.75f; Review Comment: Exposed through conf (MetastoreConf.ConfVars.PROPERTIES_CACHE_CAPACITY, MetastoreConf.ConfVars.PROPERTIES_CACHE_LOADFACTOR) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
