You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@fluo.apache.org by GitBox <gi...@apache.org> on 2017/10/20 19:35:21 UTC

[GitHub] keith-turner closed pull request #943: FLUO-942 The constructor for VisibilityCache now uses the values from?

keith-turner closed pull request #943: FLUO-942 The constructor for VisibilityCache now uses the values from?
URL: https://github.com/apache/fluo/pull/943
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactorCache.java b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactorCache.java
index c2d0d1a6..892ba4a1 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactorCache.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactorCache.java
@@ -49,8 +49,9 @@
   public TransactorCache(Environment env) {
 
     timeoutCache = CacheBuilder.newBuilder().maximumSize(1 << 15)
-        .expireAfterAccess(TxInfoCache.CACHE_TIMEOUT_MIN, TimeUnit.MINUTES).concurrencyLevel(10)
-        .build();
+        .expireAfterAccess(FluoConfigurationImpl.TX_INFO_CACHE_TIMEOUT_DEFAULT,
+            TimeUnit.MILLISECONDS)
+        .concurrencyLevel(10).build();
 
     this.env = env;
     cache = new PathChildrenCache(env.getSharedResources().getCurator(),
diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfoCache.java b/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfoCache.java
index ddd49000..6d3a49e6 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfoCache.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfoCache.java
@@ -26,8 +26,6 @@
 
 public class TxInfoCache {
 
-  static final int CACHE_TIMEOUT_MIN = 24 * 60;
-
   private static class TxStatusWeigher implements Weigher<PrimaryRowColumn, TxInfo> {
     @Override
     public int weigh(PrimaryRowColumn key, TxInfo value) {
diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java b/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java
index 06b10c47..06c43429 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java
@@ -47,9 +47,11 @@ public int weigh(Bytes key, ColumnVisibility vis) {
   private final Cache<Bytes, ColumnVisibility> visCache;
 
   VisibilityCache() {
-    visCache =
-        CacheBuilder.newBuilder().expireAfterAccess(TxInfoCache.CACHE_TIMEOUT_MIN, TimeUnit.MINUTES)
-            .maximumWeight(10000000).weigher(new VisWeigher()).concurrencyLevel(10).build();
+    visCache = CacheBuilder.newBuilder()
+        .expireAfterAccess(FluoConfigurationImpl.TX_INFO_CACHE_TIMEOUT_DEFAULT,
+            TimeUnit.MILLISECONDS)
+        .maximumWeight(FluoConfigurationImpl.TX_INFO_CACHE_SIZE_DEFAULT).weigher(new VisWeigher())
+        .concurrencyLevel(10).build();
   }
 
   public ColumnVisibility getCV(Column col) {
diff --git a/modules/core/src/test/java/org/apache/fluo/core/impl/VisibilityCacheTest.java b/modules/core/src/test/java/org/apache/fluo/core/impl/VisibilityCacheTest.java
new file mode 100644
index 00000000..81036bbe
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/fluo/core/impl/VisibilityCacheTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.fluo.core.impl;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Basic test to ensure instantiation works
+ */
+public class VisibilityCacheTest {
+
+  @Test
+  public void testVisibilityCacheConstructor() {
+    VisibilityCache cache = new VisibilityCache();
+    Assert.assertNotNull("VisibilityCache failed to instantiate.", cache);
+    cache = null;
+  }
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services