Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 43212 invoked from network); 4 Jan 2009 08:34:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jan 2009 08:34:57 -0000 Received: (qmail 16580 invoked by uid 500); 4 Jan 2009 08:34:55 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 16554 invoked by uid 500); 4 Jan 2009 08:34:55 -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 16543 invoked by uid 99); 4 Jan 2009 08:34:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Jan 2009 00:34:55 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sean.xx.qiu@gmail.com designates 209.85.200.173 as permitted sender) Received: from [209.85.200.173] (HELO wf-out-1314.google.com) (209.85.200.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Jan 2009 08:34:49 +0000 Received: by wf-out-1314.google.com with SMTP id 28so7851595wfc.24 for ; Sun, 04 Jan 2009 00:34:28 -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:to :subject:in-reply-to:mime-version:content-type:references; bh=RyrR3gywb36ejSzJdea7o3cUCW57dqIo9RO5+cfaDtU=; b=XIhllpUi+DNUDuT1lF8FuPqG/3Q7anxwYklkYiJEDJGzfd5ju7HuBWIQWaueWuuJZz qDP9jT6FTQOEkJ/3P8NUiel2Y1j56HoJiGI/2pa3U3kPtMULabC4R3/qwe2A15DQ+S2X kOvhHt7Ly1XJ+juMu0zkSHJvjDTFqu6yjFR1Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=ZJZdjC87Cxf4PY//L4cqNIMwY+BvPZMgNi2i8TD46TjSyWYYq/GPr3qzuWEWWB+P4r Ah+jiNFMN4ZZMyg/rFbnaamrv4CQ5dsbtiv59hkfqWVGI6x1Sxvg5P8fufYlNTo4OnAR iJq7oOzDzrMbPLs76Oknbl6Oul7wR88HnMyrg= Received: by 10.142.125.9 with SMTP id x9mr4060824wfc.236.1231058068594; Sun, 04 Jan 2009 00:34:28 -0800 (PST) Received: by 10.143.34.14 with HTTP; Sun, 4 Jan 2009 00:34:28 -0800 (PST) Message-ID: <94d710af0901040034m4780ef8ex2f838758cef25596@mail.gmail.com> Date: Sun, 4 Jan 2009 16:34:28 +0800 From: "Sean Qiu" To: dev@harmony.apache.org Subject: Re: Using PriviAction instead of PrivilegedAction In-Reply-To: <3b3f27c60812240806y2877509bmfd9f3ec8e365d4f9@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_221882_32751888.1231058068588" References: <70c713190812212002m55b534dbm4491148d1e3997cd@mail.gmail.com> <70c713190812212152q43f69c19y4d6c2f47a3a85fe4@mail.gmail.com> <4952188A.1030407@gmail.com> <4952208E.8090405@gmail.com> <3b3f27c60812240806y2877509bmfd9f3ec8e365d4f9@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_221882_32751888.1231058068588 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline "find . -name *.java -exec grep 'doPrivileged' {} \; | wc -l" in /modules/luni/src/main We get the fact that AccessController.doPrivileged* is called 53 times. I think it may be worth refacting it. Is there any comments about Nathan's suggestion code sample? 2008/12/25 Nathan Beyer > Agreed. The value is just eliminating some redundant code and if there > is a lot of calls in a single module, that's why I suggested a util > class for each module, as appropriate. > > -Nathan > > On Wed, Dec 24, 2008 at 5:44 AM, Tim Ellison > wrote: > > Pavel Pervov wrote: > >> As I see it this class only solves the problem of "the more anonymous > >> classes - the larger disribution is" problem. That is all. I assume we > >> want to move toward solving that problem, but I'm not quite sure if we > >> want to achieve it by using _single_ helper class for all the class > >> library. > > > > So how is this use of PriviAction: > > new PriviAction("line.separator") > > > > > > producing fewer anonymous classes than this use of PrivilegedAction: > > > > new PrivilegedAction() { > > public String run() { > > return System.getProperty("line.separator"); > > } > > } > > > > > > It is more compact in source code, but... > > > > Regards, > > Tim > > > > > >> On Wed, Dec 24, 2008 at 2:10 PM, Tim Ellison > wrote: > >>> I didn't see a good answer to Alexei's question... > >>> > >>> Alexei Fedotov wrote: > >>>> Pavel, > >>>> Kevin didn't mention performance, did he? > >>>> > >>>> I believe it is always a trade off between modularity and speed. The > >>>> performance measurement might be a part of Kevin's arguments if his > >>>> intentions are to improve the performance. That is why I asked him to > >>>> elaborate both approaches uncovering intentions. > >>>> > >>>> If our internal security interfaces are much quicker on real > >>>> applications I would wonder why our public interfaces are so slow. > >>> What problem is the PriviAction solving? I see the class comment [1] > says: > >>> > >>> "Helper class to avoid multiple anonymous inner class for > >>> java.security.AccessController#doPrivileged(PrivilegedAction) calls." > >>> > >>> Is that really a problem? For readability or performance? > >>> > >>> [1] > >>> > http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/PriviAction.java?revision=486600 > >>> > >>> Regards, > >>> Tim > >>> > >> > > > -- Best Regards Sean, Xiao Xia Qiu China Software Development Lab, IBM ------=_Part_221882_32751888.1231058068588--