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 74A7D10BD2 for ; Fri, 7 Feb 2014 16:22:43 +0000 (UTC) Received: (qmail 32414 invoked by uid 500); 7 Feb 2014 16:22:37 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 32174 invoked by uid 500); 7 Feb 2014 16:22:28 -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 31996 invoked by uid 99); 7 Feb 2014 16:22:26 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Feb 2014 16:22:26 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9E86891F354; Fri, 7 Feb 2014 16:22:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Fri, 07 Feb 2014 16:22:33 -0000 Message-Id: In-Reply-To: <195054053f734fa189133bac8a9f7539@git.apache.org> References: <195054053f734fa189133bac8a9f7539@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [09/14] git commit: ACCUMULO-2331 Actually invalidate the cache in TableConfiguration when requested. ACCUMULO-2331 Actually invalidate the cache in TableConfiguration when requested. TableConfiguration previously didn't override invalidateCache, which means that the implementations that used it and the invalidateCache method, were not providing the semantics that were intended. Fix the case in SimpleTest that outlined this issue, removing the additional poll/check loop as it was both broken and unnecessary with proper API implementation. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/510140ad Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/510140ad Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/510140ad Branch: refs/heads/1.5.1-SNAPSHOT Commit: 510140ad0cae2d54bc4c097c94cf4b024f3655bf Parents: 2c4b38c Author: Josh Elser Authored: Fri Feb 7 10:30:45 2014 -0500 Committer: Josh Elser Committed: Fri Feb 7 10:30:45 2014 -0500 ---------------------------------------------------------------------- .../java/org/apache/accumulo/proxy/SimpleTest.java | 5 ----- .../accumulo/server/conf/TableConfiguration.java | 14 +++++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/510140ad/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java ---------------------------------------------------------------------- diff --git a/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java b/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java index 6e591af..9dab290 100644 --- a/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java +++ b/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java @@ -1075,11 +1075,6 @@ public class SimpleTest { Map orig = client.getTableProperties(creds, "test"); client.setTableProperty(creds, "test", "table.split.threshold", "500M"); Map update = client.getTableProperties(creds, "test"); - for (int i = 0; i < 5; i++) { - if (update.get("table.split.threshold").equals("500M")) - break; - UtilWaitThread.sleep(200); - } assertEquals(update.get("table.split.threshold"), "500M"); client.removeTableProperty(creds, "test", "table.split.threshold"); update = client.getTableProperties(creds, "test"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/510140ad/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java b/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java index c5b6c18..59ff1f7 100644 --- a/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java +++ b/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java @@ -38,7 +38,8 @@ import org.apache.log4j.Logger; public class TableConfiguration extends AccumuloConfiguration { private static final Logger log = Logger.getLogger(TableConfiguration.class); - private static ZooCache tablePropCache = null; + // Need volatile keyword to ensure double-checked locking works as intended + private static volatile ZooCache tablePropCache = null; private final String instanceId; private final AccumuloConfiguration parent; @@ -147,4 +148,15 @@ public class TableConfiguration extends AccumuloConfiguration { public String getTableId() { return table; } + + @Override + public void invalidateCache() { + if (null != tablePropCache) { + synchronized (TableConfiguration.class) { + if (null != tablePropCache) { + tablePropCache = null; + } + } + } + } }