Return-Path: X-Original-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0095E9EBA for ; Fri, 7 Oct 2011 14:05:04 +0000 (UTC) Received: (qmail 81903 invoked by uid 500); 7 Oct 2011 14:05:03 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 81854 invoked by uid 500); 7 Oct 2011 14:05:03 -0000 Mailing-List: contact connectors-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-commits@incubator.apache.org Received: (qmail 81847 invoked by uid 99); 7 Oct 2011 14:05:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Oct 2011 14:05:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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, 07 Oct 2011 14:05:02 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4DCCA23888FE; Fri, 7 Oct 2011 14:04:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1180045 - in /incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki: PageBuffer.java WikiConnector.java Date: Fri, 07 Oct 2011 14:04:42 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111007140442.4DCCA23888FE@eris.apache.org> Author: kwright Date: Fri Oct 7 14:04:41 2011 New Revision: 1180045 URL: http://svn.apache.org/viewvc?rev=1180045&view=rev Log: Add the ability to abandon a PageBuffer object, since otherwise it would be possible to have a stuck child thread forever in the case of a parent thread throwing an exception. Modified: incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/PageBuffer.java incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java Modified: incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/PageBuffer.java URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/PageBuffer.java?rev=1180045&r1=1180044&r2=1180045&view=diff ============================================================================== --- incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/PageBuffer.java (original) +++ incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/PageBuffer.java Fri Oct 7 14:04:41 2011 @@ -28,6 +28,7 @@ public class PageBuffer protected List buffer = new ArrayList(MAX_SIZE); protected boolean complete = false; + protected boolean abandoned = false; /** Constructor */ public PageBuffer() @@ -38,13 +39,23 @@ public class PageBuffer public synchronized void add(String pageID) throws InterruptedException { - while (buffer.size() == MAX_SIZE) + while (buffer.size() == MAX_SIZE && !abandoned) wait(); + if (abandoned) + return; buffer.add(pageID); // Notify threads that are waiting on there being stuff in the queue notifyAll(); } + /** Signal that the buffer should be abandoned */ + public synchronized void abandon() + { + abandoned = true; + // Notify waiting threads + notifyAll(); + } + /** Signal that the operation is complete, and that no more pageID's * will be added. */ Modified: incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java?rev=1180045&r1=1180044&r2=1180045&view=diff ============================================================================== --- incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java (original) +++ incubator/lcf/branches/CONNECTORS-256/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java Fri Oct 7 14:04:41 2011 @@ -1033,6 +1033,11 @@ public class WikiConnector extends org.a // We need the caller to abandon any connections left around, so rethrow in a way that forces them to process the event properly. throw e; } + finally + { + // Make SURE buffer is dead, otherwise child thread may well hang waiting on it + pageBuffer.abandon(); + } } catch (InterruptedException e) {