Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!feeder.news-service.com!postnews.google.com!news2.google.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, 22 Jul 2011 11:45:33 -0500 Date: Fri, 22 Jul 2011 09:45:31 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Why "lock" functionality is introduced for all the objects? References: <4e28c4c4$0$308$14726298@news.sunsite.dk> <4e298683$0$315$14726298@news.sunsite.dk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Lines: 31 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.200.239 X-Trace: sv3-Ye9Rny2Q3WmNveHyu2jsQL+YhyYSjah9NiF/n/n8uum4NtkZ6zsnCnJtZ94Iaa4wuy7PNx62LH/yH+D!6HI5gPRG9KqkotO67iM6RQtSgGwTK7h/poWz7ki+WwVIskM0n0fxRALVSeDL74yhNB7/Z/VmfcN+!56hxRtiAHQMv5rxb6qA2AQyVlCT1/OAAIvpOixxeWpgiNqo= 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: 2827 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6403 On 7/22/2011 9:30 AM, Patricia Shanahan wrote: > On 7/22/2011 7:17 AM, Arne Vajhøj wrote: >> On 7/22/2011 12:20 AM, Henderson wrote: >>> On 21/07/2011 8:30 PM, Arne Vajhøj wrote: >>>> On 6/30/2011 6:04 PM, Tom Anderson wrote: >>>>> On Tue, 28 Jun 2011, Alex J wrote: >>>>>> The better decision, IMHO, would be to introduce lock/wait mechanics >>>>>> for only, say, the Lockable descendants. >>>>> >>>>> I agree with this, actually. There might be some small performance >>>>> improvement, but it would also make the locking behaviour of code more >>>>> explicit, and so clearer. >>>> >>>> Given that Java does not allow multiple inheritance then that would >>>> have been tough restriction. >>> >>> Others suggested that Lockable could have been a marker interface with >>> special significance to the compiler, ala Serializable. Java allows >>> multiple inheritance of interfaces. >> >> It could be, but does that provide any space in the data structure? > > Compiler magic. Just as the compiler reacts the lack of any constructor > by generating a default constructor, it would react to the Lockable > interface by generating a field to contain the lock data. More precisely, it would generate the field if the class is Lockable and its immediate superclass is not Lockable. There should be at most one lock field in the object. Patricia