ACCUMULO-4041 memoize isSensitive for faster lookups in getSiteConfiguration


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/78522c4c
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/78522c4c
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/78522c4c

Branch: refs/heads/master
Commit: 78522c4cd4432ee2ab78c4b585fa040ff4e1c365
Parents: 1619ae4
Author: Eric C. Newton <eric.new...@gmail.com>
Authored: Fri Nov 13 06:53:56 2015 -0500
Committer: Eric C. Newton <eric.new...@gmail.com>
Committed: Fri Nov 13 06:53:56 2015 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/accumulo/core/conf/Property.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/78522c4c/core/src/main/java/org/apache/accumulo/core/conf/Property.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java 
b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index d17b8aa..6d1f043 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -523,8 +523,13 @@ public enum Property {
     return hasAnnotation(Deprecated.class) || 
hasPrefixWithAnnotation(getKey(), Deprecated.class);
   }
 
+  private volatile Boolean isSensitive = null;
+
   public boolean isSensitive() {
-    return hasAnnotation(Sensitive.class) || hasPrefixWithAnnotation(getKey(), 
Sensitive.class);
+    if (isSensitive == null) {
+      isSensitive = hasAnnotation(Sensitive.class) || 
hasPrefixWithAnnotation(getKey(), Sensitive.class);
+    }
+    return isSensitive.booleanValue();
   }
 
   public static boolean isSensitive(String key) {

Reply via email to