Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: A question about synchronized threads Date: Fri, 29 Apr 2011 11:11:42 -0700 Organization: A noiseless patient Spider Lines: 16 Message-ID: References: <3f249d87-aaf8-4732-9ee8-fd112cf82553@f31g2000pri.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=EUC-KR Content-Transfer-Encoding: 7bit Injection-Date: Fri, 29 Apr 2011 18:11:50 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="pYb/yoo+Q58g8sOMt7I33A"; logging-data="12037"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bnNfiEhfYLdefzl7Lwpig5IOK6YMjAx0=" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: Cancel-Lock: sha1:zq0RUhMqXTaiRdw5OyaYRtthq24= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3359 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.