harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [classlib] Recognizing lock objects
Date Wed, 04 Oct 2006 12:20:18 GMT
Anton Luht wrote:
> Hello,
> 
> Maybe it's better to mark 'locking' objects with something like
> //$LOCK-1$ ? New Object() can be created for many purposes - I'm not
> sure what percent is used for locks - 10 or 90.

If it is just used for locking I'm changing the type, so there will no
need for the lock comment too.

> Another suggestion: use
> 
> new Object() {
>   public String toString() {
>         return "something that contains some locking keyword";
>   }
> }

That doesn't help distinguish them so easily, e.g. TI-based tools.

Regards,
Tim


> On 10/4/06, Tim Ellison <t.p.ellison@gmail.com> wrote:
>> BTW, as I go through the code looking at the occurrences of 'new
>> Object()' and determining if they are used simply for their locks, I
>> figured we also need a way to record the check has been done.
>>
>> So, if there is a 'new Object()' that is not simply a lock object (and
>> therefore named as we agreed) I'll mark it on the same line as
>> // $NON-LOCK-1$ so we can easily grep for divergences from the pattern.
>>
>> Regards,
>> Tim
>>
>> Mikhail Fursov wrote:
>> > Another variant is to use anonymous class without the name:
>> >    Object lock = new Object(){};
>> >
>> > But the name by itself (RepositionLock) serves like a comment.
>> >
>> >
>> > On 10/3/06, Tim Ellison <t.p.ellison@gmail.com> wrote:
>> >>
>> >>     private class RepositionLock {}
>> >>     private Object repositionLock = new RepositionLock();
>> >>
>> >>
>> >
>> >
>>
>> -- 
>>
>> Tim Ellison (t.p.ellison@gmail.com)
>> IBM Java technology centre, UK.
>>
>> ---------------------------------------------------------------------
>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>>
>>
> 
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message