Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0DDF31859B for ; Fri, 13 Nov 2015 13:43:04 +0000 (UTC) Received: (qmail 68342 invoked by uid 500); 13 Nov 2015 13:43:04 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 68233 invoked by uid 500); 13 Nov 2015 13:43:04 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 68071 invoked by uid 99); 13 Nov 2015 13:43:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Nov 2015 13:43:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C5735E041F; Fri, 13 Nov 2015 13:43:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ecn@apache.org To: commits@accumulo.apache.org Date: Fri, 13 Nov 2015 13:43:06 -0000 Message-Id: In-Reply-To: <27f4750d21174eb4ab9c668c46cf3341@git.apache.org> References: <27f4750d21174eb4ab9c668c46cf3341@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/6] accumulo git commit: ACCUMULO-4041 memoize isSensitive for faster lookups in getSiteConfiguration 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/81b6d5b9 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/81b6d5b9 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/81b6d5b9 Branch: refs/heads/master Commit: 81b6d5b94d4e99d68fd0fcc07433e25219cecd94 Parents: b8ffe4c 78522c4 Author: Eric C. Newton Authored: Fri Nov 13 06:57:34 2015 -0500 Committer: Eric C. Newton Committed: Fri Nov 13 06:57:34 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/81b6d5b9/core/src/main/java/org/apache/accumulo/core/conf/Property.java ---------------------------------------------------------------------- diff --cc core/src/main/java/org/apache/accumulo/core/conf/Property.java index 055e7dd,6d1f043..df53791 --- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java @@@ -668,23 -523,15 +668,28 @@@ public enum Property return hasAnnotation(Deprecated.class) || hasPrefixWithAnnotation(getKey(), Deprecated.class); } + private volatile Boolean isSensitive = null; + + /** + * Checks if this property is sensitive. + * + * @return true if this property is sensitive + */ 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(); } + /** + * Checks if a property with the given key is sensitive. The key must be for a valid property, and must either itself be annotated as sensitive or have a + * prefix annotated as sensitive. + * + * @param key + * property key + * @return true if property is sensitive + */ public static boolean isSensitive(String key) { return hasPrefixWithAnnotation(key, Sensitive.class); }