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 50FBD107FC for ; Wed, 19 Mar 2014 16:09:21 +0000 (UTC) Received: (qmail 1036 invoked by uid 500); 19 Mar 2014 16:08:50 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 760 invoked by uid 500); 19 Mar 2014 16:08:40 -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 99625 invoked by uid 99); 19 Mar 2014 16:08:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Mar 2014 16:08:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A2A7F984639; Wed, 19 Mar 2014 16:08:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ujustgotbilld@apache.org To: commits@accumulo.apache.org Date: Wed, 19 Mar 2014 16:08:28 -0000 Message-Id: <07744d2f79394152ac4de09fc8d1b87c@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [18/50] [abbrv] git commit: ACCUMULO-474: memoize ColumnVisibility objects to decrease memory usage ACCUMULO-474: memoize ColumnVisibility objects to decrease memory usage git-svn-id: https://svn.apache.org/repos/asf/incubator/accumulo/branches/1.4@1302914 13f79535-47bb-0310-9956-ffa450edef68 Project: http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/commit/53337735 Tree: http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/tree/53337735 Diff: http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/diff/53337735 Branch: refs/heads/master Commit: 533377356b3f2999c7e15d7e948c487d22463186 Parents: 2c1666f Author: Eric C. Newton Authored: Tue Mar 20 14:32:50 2012 +0000 Committer: Eric C. Newton Committed: Tue Mar 20 14:32:50 2012 +0000 ---------------------------------------------------------------------- .../wikisearch/iterator/EvaluatingIterator.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/blob/53337735/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/EvaluatingIterator.java ---------------------------------------------------------------------- diff --git a/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/EvaluatingIterator.java b/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/EvaluatingIterator.java index 8dde40f..d51023c 100644 --- a/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/EvaluatingIterator.java +++ b/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/EvaluatingIterator.java @@ -30,12 +30,14 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.accumulo.examples.wikisearch.parser.EventFields; import org.apache.accumulo.examples.wikisearch.parser.EventFields.FieldValue; +import org.apache.commons.collections.map.LRUMap; import org.apache.hadoop.io.Text; public class EvaluatingIterator extends AbstractEvaluatingIterator { public static final String NULL_BYTE_STRING = "\u0000"; + LRUMap visibilityMap = new LRUMap(); public EvaluatingIterator() { super(); @@ -78,7 +80,20 @@ public class EvaluatingIterator extends AbstractEvaluatingIterator { String fieldName = colq.substring(0, idx); String fieldValue = colq.substring(idx + 1); - event.put(fieldName, new FieldValue(new ColumnVisibility(key.getColumnVisibility().getBytes()), fieldValue.getBytes())); + event.put(fieldName, new FieldValue(getColumnVisibility(key), fieldValue.getBytes())); + } + + /** + * @param key + * @return + */ + public ColumnVisibility getColumnVisibility(Key key) { + ColumnVisibility result = (ColumnVisibility) visibilityMap.get(key.getColumnVisibility()); + if (result != null) + return result; + result = new ColumnVisibility(key.getColumnVisibility().getBytes()); + visibilityMap.put(key.getColumnVisibility(), result); + return result; } /**