tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1051539 - /tomcat/trunk/java/org/apache/tomcat/util/threads/CounterLatch.java
Date Wed, 29 Dec 2010 00:02:29 GMT
On 22 December 2010 16:04, Filip Hanik - Dev Lists <devlists@hanik.com> wrote:
> On 12/21/2010 7:29 PM, sebb wrote:
>>
>>> -    private long signal;
>>> +    private volatile long signal;
>>
>> It would be cheaper to make it final as it's only ever set in the ctor
>> and is immutable.
>
> nothing cheaper, volatile are only expensive to write, not read.

That's not my understanding of how volatile works.

AIUI, the reader thread always needs to refresh the value of the field
in case another thread has updated it.

Whereas a final field can be safely cached in local memory.

> If maxConnections becomes a dynamically adjustable attribute, so will this one
> have to be.

True, but at present it is immutable.

>>>
>>>     private volatile boolean released = false;
>>>
>>>     /**
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>>
>>
>> -----
>> No virus found in this message.
>> Checked by AVG - www.avg.com
>> Version: 10.0.1170 / Virus Database: 1435/3329 - Release Date: 12/21/10
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message