EdColeman commented on code in PR #2569:
URL: https://github.com/apache/accumulo/pull/2569#discussion_r850833319


##########
server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImpl.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * 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.accumulo.server.conf.store.impl;
+
+import java.util.Objects;
+import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.accumulo.core.util.threads.ThreadPools;
+import org.apache.accumulo.server.conf.codec.VersionedProperties;
+import org.apache.accumulo.server.conf.store.PropCache;
+import org.apache.accumulo.server.conf.store.PropCacheKey;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.benmanes.caffeine.cache.CacheLoader;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.LoadingCache;
+import com.github.benmanes.caffeine.cache.RemovalCause;
+import com.github.benmanes.caffeine.cache.Ticker;
+import com.google.common.annotations.VisibleForTesting;
+
+public class PropCacheCaffeineImpl implements PropCache {
+
+  public static final TimeUnit BASE_TIME_UNITS = TimeUnit.MINUTES;
+  public static final int REFRESH_MIN = 15;
+  public static final int EXPIRE_MIN = 60;
+  private static final Logger log = 
LoggerFactory.getLogger(PropCacheCaffeineImpl.class);
+  private static final Executor executor = 
ThreadPools.getServerThreadPools().createThreadPool(1,
+      20, 60, TimeUnit.SECONDS, "cache-refresh", false);
+
+  private final PropStoreMetrics metrics;
+
+  private final LoadingCache<PropCacheKey,VersionedProperties> cache;
+
+  private PropCacheCaffeineImpl(final 
CacheLoader<PropCacheKey,VersionedProperties> cacheLoader,
+      final PropStoreMetrics metrics, final Ticker ticker) {
+    this.metrics = metrics;
+
+    if (ticker != null) { // build test instance with artificial clock.

Review Comment:
   Fixed in 894d4fa9a6



-- 
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]

Reply via email to