Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-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 841E7DB10 for ; Mon, 12 Nov 2012 20:03:09 +0000 (UTC) Received: (qmail 42262 invoked by uid 500); 12 Nov 2012 20:03:09 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 42219 invoked by uid 500); 12 Nov 2012 20:03:09 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 42212 invoked by uid 99); 12 Nov 2012 20:03:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Nov 2012 20:03:09 +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; Mon, 12 Nov 2012 20:03:06 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CA96723889D7; Mon, 12 Nov 2012 20:02:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1408433 - /manifoldcf/branches/CONNECTORS-120/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java Date: Mon, 12 Nov 2012 20:02:45 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121112200245.CA96723889D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Mon Nov 12 20:02:45 2012 New Revision: 1408433 URL: http://svn.apache.org/viewvc?rev=1408433&view=rev Log: Throw an InterruptedIOException if the thread is interrupted. Modified: manifoldcf/branches/CONNECTORS-120/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java Modified: manifoldcf/branches/CONNECTORS-120/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-120/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java?rev=1408433&r1=1408432&r2=1408433&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-120/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java (original) +++ manifoldcf/branches/CONNECTORS-120/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java Mon Nov 12 20:02:45 2012 @@ -105,37 +105,50 @@ public class XThreadInputStream extends public int read(byte[] b, int off, int len) throws IOException { - int totalAmt = 0; - while (true) + try { - if (len == 0) - return 0; - int copyLen; - synchronized (this) + int totalAmt = 0; + while (true) { - if (streamEnd) + if (len == 0) + return 0; + int copyLen; + synchronized (this) { - if (totalAmt != 0) - return totalAmt; - return -1; + copyLen = byteCount; + if (copyLen > len) + copyLen = len; + int remLen = buffer.length - startPoint; + if (copyLen > remLen) + copyLen = remLen; + if (copyLen == 0) + { + if (streamEnd) + { + if (totalAmt != 0) + return totalAmt; + return -1; + } + wait(); + continue; + } + } + System.arraycopy(buffer, startPoint, b, off, copyLen); + totalAmt += copyLen; + len -= copyLen; + synchronized (this) + { + startPoint += copyLen; + startPoint &= (buffer.length - 1); + byteCount -= copyLen; + notifyAll(); } - copyLen = byteCount; - if (copyLen > len) - copyLen = len; - int remLen = buffer.length - startPoint; - if (copyLen > remLen) - copyLen = remLen; - } - System.arraycopy(buffer, startPoint, b, off, copyLen); - totalAmt += copyLen; - len -= copyLen; - synchronized (this) - { - startPoint += copyLen; - startPoint &= (buffer.length - 1); - byteCount -= copyLen; } } + catch (InterruptedException e) + { + throw new InterruptedIOException(e.getMessage()); + } } /** Skip