Return-Path: Delivered-To: apmail-lucene-java-commits-archive@www.apache.org Received: (qmail 23477 invoked from network); 10 Jan 2008 18:22:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jan 2008 18:22:17 -0000 Received: (qmail 67242 invoked by uid 500); 10 Jan 2008 18:22:06 -0000 Delivered-To: apmail-lucene-java-commits-archive@lucene.apache.org Received: (qmail 67217 invoked by uid 500); 10 Jan 2008 18:22:06 -0000 Mailing-List: contact java-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-commits@lucene.apache.org Received: (qmail 67206 invoked by uid 99); 10 Jan 2008 18:22:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jan 2008 10:22:06 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jan 2008 18:22:02 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 944101A9832; Thu, 10 Jan 2008 10:21:52 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r610860 - /lucene/java/branches/lucene_2_3/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java Date: Thu, 10 Jan 2008 18:21:52 -0000 To: java-commits@lucene.apache.org From: mikemccand@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080110182152.944101A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mikemccand Date: Thu Jan 10 10:21:51 2008 New Revision: 610860 URL: http://svn.apache.org/viewvc?rev=610860&view=rev Log: LUCENE-1117 on 2.3 branch: fix EnwikiDocMaker to not hang when the producer thread hits exception Modified: lucene/java/branches/lucene_2_3/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java Modified: lucene/java/branches/lucene_2_3/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_3/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java?rev=610860&r1=610859&r2=610860&view=diff ============================================================================== --- lucene/java/branches/lucene_2_3/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java (original) +++ lucene/java/branches/lucene_2_3/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java Thu Jan 10 10:21:51 2008 @@ -47,6 +47,7 @@ class Parser extends DefaultHandler implements Runnable { Thread t; + boolean threadDone; public void run() { @@ -86,8 +87,12 @@ throw new RuntimeException(sae); } catch (IOException ioe) { throw new RuntimeException(ioe); + } finally { + synchronized(this) { + threadDone = true; + notify(); + } } - } String[] tuple; @@ -95,13 +100,14 @@ String[] next() throws NoMoreDataException { if (t == null) { + threadDone = false; t = new Thread(this); t.setDaemon(true); t.start(); } String[] result; synchronized(this){ - while(tuple == null && nmde == null){ + while(tuple == null && nmde == null && !threadDone) { try { wait(); } catch (InterruptedException ie) { @@ -113,6 +119,12 @@ t = null; throw nmde; } + if (t != null && threadDone) + // The thread has exited yet did not hit end of + // data, so this means it hit an exception. We + // throw NoMorDataException here to force + // benchmark to stop the current alg: + throw new NoMoreDataException(); result = tuple; tuple = null; notify();