Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.straub-nv.de!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 29 Apr 2011 23:10:32 -0500 Date: Fri, 29 Apr 2011 21:10:21 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: A question about synchronized threads References: <3f249d87-aaf8-4732-9ee8-fd112cf82553@f31g2000pri.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 29 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.8.126.96 X-Trace: sv3-Tn7U5RlbGGZrvDCQI6+BK/lg/S3xdxWt5qVU7NRM+n3l3ntzPSpOPeG7CWPBn+WM//hoel6J06Ax0dZ!TBqxACI0t+AmZqlDqJ9vWtJS3s6Z+haqJ7PUXK2+QL/p26VzU2IMeHsDbd+hSGVWlzOLy7wpUKhj!vf6bZ7n2YdeZffDOnKZDa4A1HywCzSW+oGdfn3rZK/c= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2524 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3373 On 4/29/2011 11:19 AM, Daniele Futtorovic wrote: > On 29/04/2011 20:11, markspace allegedly wrote: >> On 4/29/2011 9:09 AM, byhesed wrote: >>> >>> Thank you. I understand what you elaborated on. >> >> >> I hope so. "Optimizing" threads is tricky, and when you reason about >> how to optimize it's easy to make a mistake. Prominent Java engineers >> (i.e., Doug Lea) have been known to make mistakes. >> >> Remember, m1 and m2 can't share mutual state. If they do, you're going >> to have problems accessing any variables that are shared. > >> I'd be interested in seeing what it is you want to optimize. What does >> this class really look like? I think it might be instructive for you to >> post your full class, and let other comment on how best to "optimize" it. > > Ten bucks say it's a class with too many methods. ;) > It may only have two methods. However, I would not bet against it being a class with too much unrelated data. There are two methods in the class that operate on two sets of data that are not only totally disjoint, but so unrelated that it does not matter if they are inconsistent with each other. Patricia