Return-Path: Delivered-To: apmail-hadoop-hbase-commits-archive@locus.apache.org Received: (qmail 478 invoked from network); 5 Dec 2008 05:26:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Dec 2008 05:26:52 -0000 Received: (qmail 18159 invoked by uid 500); 5 Dec 2008 05:27:04 -0000 Delivered-To: apmail-hadoop-hbase-commits-archive@hadoop.apache.org Received: (qmail 18133 invoked by uid 500); 5 Dec 2008 05:27:04 -0000 Mailing-List: contact hbase-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hbase-dev@hadoop.apache.org Delivered-To: mailing list hbase-commits@hadoop.apache.org Received: (qmail 18124 invoked by uid 99); 5 Dec 2008 05:27:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Dec 2008 21:27:04 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Dec 2008 05:25:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 68A6E2388886; Thu, 4 Dec 2008 21:26:30 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r723589 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/Chore.java src/java/org/apache/hadoop/hbase/util/Sleeper.java Date: Fri, 05 Dec 2008 05:26:29 -0000 To: hbase-commits@hadoop.apache.org From: stack@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081205052630.68A6E2388886@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stack Date: Thu Dec 4 21:26:28 2008 New Revision: 723589 URL: http://svn.apache.org/viewvc?rev=723589&view=rev Log: HBASE-1000 Sleeper.sleep does not go back to sleep when interrupted and no stop flag given. Modified: hadoop/hbase/trunk/CHANGES.txt hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/Chore.java hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Sleeper.java Modified: hadoop/hbase/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=723589&r1=723588&r2=723589&view=diff ============================================================================== --- hadoop/hbase/trunk/CHANGES.txt (original) +++ hadoop/hbase/trunk/CHANGES.txt Thu Dec 4 21:26:28 2008 @@ -99,6 +99,8 @@ HBASE-1039 Compaction fails if bloomfilters are enabled HBASE-1027 Make global flusher check work with percentages rather than hard code memory sizes + HBASE-1000 Sleeper.sleep does not go back to sleep when interrupted + and no stop flag given. IMPROVEMENTS HBASE-901 Add a limit to key length, check key and value length on client side Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/Chore.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/Chore.java?rev=723589&r1=723588&r2=723589&view=diff ============================================================================== --- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/Chore.java (original) +++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/Chore.java Thu Dec 4 21:26:28 2008 @@ -59,19 +59,21 @@ this.sleeper.sleep(); } this.sleeper.sleep(); - while(!this.stop.get()) { + while (!this.stop.get()) { + long startTime = System.currentTimeMillis(); try { - long startTime = System.currentTimeMillis(); chore(); - this.sleeper.sleep(startTime); } catch (Exception e) { LOG.error("Caught exception", e); + if (this.stop.get()) { + continue; + } } + this.sleeper.sleep(startTime); } } catch (Throwable t) { LOG.fatal("Caught error. Starting shutdown.", t); this.stop.set(true); - } finally { LOG.info(getName() + " exiting"); } @@ -97,4 +99,4 @@ protected void sleep() { this.sleeper.sleep(); } -} \ No newline at end of file +} Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Sleeper.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Sleeper.java?rev=723589&r1=723588&r2=723589&view=diff ============================================================================== --- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Sleeper.java (original) +++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/Sleeper.java Thu Dec 4 21:26:28 2008 @@ -66,11 +66,14 @@ LOG.warn("Calculated wait time > " + this.period + "; setting to this.period: " + System.currentTimeMillis() + ", " + startTime); + waitTime = this.period; } - if (waitTime > 0) { + while (waitTime > 0) { + long woke = -1; try { Thread.sleep(waitTime); - long slept = System.currentTimeMillis() - now; + woke = System.currentTimeMillis(); + long slept = woke - now; if (slept > (10 * this.period)) { LOG.warn("We slept " + slept + "ms, ten times longer than scheduled: " + this.period); @@ -82,6 +85,9 @@ return; } } + // Recalculate waitTime. + woke = (woke == -1)? System.currentTimeMillis(): woke; + waitTime = this.period - (woke - startTime); } } }