Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 69459 invoked from network); 27 Mar 2008 15:05:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Mar 2008 15:05:35 -0000 Received: (qmail 78454 invoked by uid 500); 27 Mar 2008 15:05:34 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 78432 invoked by uid 500); 27 Mar 2008 15:05:34 -0000 Mailing-List: contact commits-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 commits@harmony.apache.org Received: (qmail 78423 invoked by uid 99); 27 Mar 2008 15:05:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2008 08:05:34 -0700 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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2008 15:05:03 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 50F41234C0A8 for ; Thu, 27 Mar 2008 08:03:24 -0700 (PDT) Message-ID: <1864945970.1206630204330.JavaMail.jira@brutus> Date: Thu, 27 Mar 2008 08:03:24 -0700 (PDT) From: "Aleksey Shipilev (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-5635) [classlib][luni][performance] ObjectInputStream should empty the underlying stream in right way In-Reply-To: <243597206.1206303684510.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-5635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582675#action_12582675 ] Aleksey Shipilev commented on HARMONY-5635: ------------------------------------------- Thanks, Tim! Sorry for (1), it was my oversight. You're right. > [classlib][luni][performance] ObjectInputStream should empty the underlying stream in right way > ----------------------------------------------------------------------------------------------- > > Key: HARMONY-5635 > URL: https://issues.apache.org/jira/browse/HARMONY-5635 > Project: Harmony > Issue Type: Improvement > Reporter: Aleksey Shipilev > Assignee: Tim Ellison > Attachments: 0003-serial-emptystream.patch > > > For now, ObjectInputStream empties the underlying stream by assigning it to static emptyStream instance. > This is very buggy way to do things, for two reasons: > 1. Consider you've done > ByteArrayInputStream temp1 = emptyStream; > then you might do temp1.write(...) and spoil the emptyStream with garbage. Luckily there are no such opportunities in current OIS. > 2. Consider you've "emptied" several streams in different threads and then ask for OIS.available() then you would have the BAIS.available() [synchronized by spec] - and the _contention_, up to fat monitors invocation. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.