From dev-return-35383-apmail-harmony-dev-archive=harmony.apache.org@harmony.apache.org Mon Nov 17 08:57:51 2008 Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 1685 invoked from network); 17 Nov 2008 08:57:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Nov 2008 08:57:51 -0000 Received: (qmail 50147 invoked by uid 500); 17 Nov 2008 08:57:58 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 49841 invoked by uid 500); 17 Nov 2008 08:57:57 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 49830 invoked by uid 99); 17 Nov 2008 08:57:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Nov 2008 00:57:57 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of t.p.ellison@gmail.com designates 66.249.92.174 as permitted sender) Received: from [66.249.92.174] (HELO ug-out-1314.google.com) (66.249.92.174) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Nov 2008 08:56:35 +0000 Received: by ug-out-1314.google.com with SMTP id m2so380352ugc.22 for ; Mon, 17 Nov 2008 00:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=QDVU2uUZzBeJ0/8utZurruCl6TkjB00AqQ/T0H/hmvQ=; b=TnexZaUGscpKwdA521NsIEnZN2ygBzhwwoIThVbWwuFrLfSANznpSPHumsMAj5QdUD D3oxi6sV+CWbf1G9Ph1PACo6BnehpZzjYMvwmsZHeMp4zHNMHEy6Hxx4ULK+G08NPSUs cs7rDmNTo7IMS+Lvw9QUwG6HIJ9xZ8MMxvHPo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=pZwo7whmnRGWi/mrSCuOntShLpS5MnH+wYzf4xs827F95eTaLuDAhtpL4BkZHF1wN1 PF+WkomDFBNvqg8RTTKeAPaggoFgwK/qqdrIxli5FKarbO5ya/WuMMYTS9/HaT1UYb9I oZT+u5QpiH1V6hz1dS5nN2m0NOqAVKRFvBjNo= Received: by 10.67.96.9 with SMTP id y9mr1146058ugl.64.1226912228802; Mon, 17 Nov 2008 00:57:08 -0800 (PST) Received: from ?192.168.0.5? ([78.149.132.21]) by mx.google.com with ESMTPS id y6sm2039301uge.28.2008.11.17.00.57.07 (version=SSLv3 cipher=RC4-MD5); Mon, 17 Nov 2008 00:57:07 -0800 (PST) Message-ID: <492131E0.7040608@gmail.com> Date: Mon, 17 Nov 2008 08:57:04 +0000 From: Tim Ellison User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: dev@harmony.apache.org Subject: Re: [classlib][luni] BufferedInputStream can not be closed in another thread (HARMONY-6014) References: <571078278.1226587184460.JavaMail.jira@brutus> <491C6147.6080509@gmail.com> <491D5505.7000608@gmail.com> <491D72BD.9010804@gmail.com> <491D75F9.5090301@gmail.com> <4920F24A.1040508@gmail.com> In-Reply-To: <4920F24A.1040508@gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Regis wrote: > I just read the spec, it doesn't say the read method is synchronized or > thread-safe. Agreed. The class description doesn't say anything about multiple threads. > I think BufferedInputStream just need to keep itself status consistent, > he never know how is the InputStream implemented, it's better to left > synchronous/asynchronous problems handled by the wrapped stream. Well at the moment we have the methods on BufferedInputStream marked as synchronized. That will ensure the consistency of the state in the buffered stream, and in the wrapped stream. Relaxing the sync on close() would pass through the multi-threading problems to the wrapped stream, but we still need to ensure the buffered stream is consistent, and that is non-trivial too (see my patch on the JIRA). Regards, Tim