From issues-return-14642-apmail-commons-issues-archive=commons.apache.org@commons.apache.org Wed Aug 04 21:18:41 2010 Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 50186 invoked from network); 4 Aug 2010 21:18:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Aug 2010 21:18:41 -0000 Received: (qmail 82044 invoked by uid 500); 4 Aug 2010 21:18:40 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 81957 invoked by uid 500); 4 Aug 2010 21:18:40 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 81949 invoked by uid 99); 4 Aug 2010 21:18:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Aug 2010 21:18:40 +0000 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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Aug 2010 21:18:37 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o74LIGDv013746 for ; Wed, 4 Aug 2010 21:18:16 GMT Message-ID: <25455770.166991280956696068.JavaMail.jira@thor> Date: Wed, 4 Aug 2010 17:18:16 -0400 (EDT) From: "Niall Pemberton (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (IO-201) CountingInputStream/CountingOutputStream only partially synchronized In-Reply-To: <582804590.1238075998773.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/IO-201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Niall Pemberton updated IO-201: ------------------------------- Fix Version/s: 2.x The resetCount method was added with the synchronized keyword: * https://svn.apache.org/viewvc?view=revision&revision=140583 The getCount() methods were synchronzied later for the changes IO-84 - but theres no mention of why * https://svn.apache.org/viewvc?view=revision&revision=462818 I agree the syncronization is incomplete and could probably be removed. Seems like a minor thing though so. I'm assigning this to 2.x. > CountingInputStream/CountingOutputStream only partially synchronized > -------------------------------------------------------------------- > > Key: IO-201 > URL: https://issues.apache.org/jira/browse/IO-201 > Project: Commons IO > Issue Type: Bug > Components: Filters > Affects Versions: 1.4 > Reporter: Sebb > Fix For: 2.x > > > CountingInputStream is only partially synchronized. > The count is not synchronized when it is updated in read operations, so is not guaranteed to be published correctly > The synchronization could be removed without loss of functionality. > Not sure it makes sense to share a stream between threads anyway, as the underlying stream is unlikely to be thread-safe. > If only one thread reads the stream, then the count field could be made volatile. > This would allow other threads to read the count safely. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.