Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: A question about synchronized threads Date: Fri, 29 Apr 2011 20:19:31 +0200 Organization: A noiseless patient Spider Lines: 19 Message-ID: References: <3f249d87-aaf8-4732-9ee8-fd112cf82553@f31g2000pri.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 29 Apr 2011 18:19:31 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="HVQCu0Y2HgWFwFmevj7r/w"; logging-data="16183"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zzrABf9wc1mHsxrL1QnfY" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:CvZQUhTd7A9keuKmBLWfavgIRQE= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3360 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. ;)