mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@apache.org>
Subject Re: Should all configuration properties be volatile? (Was: Re: Visibility of idle time changes in BaseIoSession)
Date Wed, 14 May 2008 17:11:21 GMT
David M. Lloyd wrote:
> On 05/14/2008 10:55 AM, Emmanuel Lecharny wrote:
>> Sangjin Lee wrote:
>>> Hmm...  Could you share a simple example of a non-volatile variable 
>>> that
>>> respects the volatile contract?
>>>   
>>
>> any boolean.
>
> This is incorrect.  Changes made to a boolean that is not volatile may 
> never become visible in another thread.
Sorry, I didn't read the question carefully. You are right David.

What I meant is that a volatile boolean is clearly protected, as you 
can't apply simple opration like ++ or -- on it. I don't know about :
volatile boolean b = Boolean.TRUE;
...
b = !b; // Might fails if used in a concurrent portion of the code.
...

-- 
--
cordialement, regards,
Emmanuel L├ęcharny
www.iktek.com
directory.apache.org



Mime
View raw message