[concurrency-interest] Stupid Question

Stanimir Simeonoff stanimir at riflexo.com
Tue Feb 12 16:49:13 EST 2013


Rémi
> * and yes, final field can be changed.
>
> Yeah, Cliff Click had a couple of posts regarding that. It's even used in
java.util.Random (unsafe.putObjectVolatile), albeit before the object
actually is 'published'.
It's hard to optimize and not break code.

Stanimir


>
>
>>
>>
>>  Thanks
>>>
>>> -Pete
>>>
>>>      public int remainingCapacity() {
>>>          final ReentrantLock lock = this.lock;
>>>          lock.lock();
>>>          try {
>>>              return items.length - count;
>>>          } finally {
>>>              lock.unlock();
>>>          }
>>>      }
>>>
>>> ______________________________**_________________
>>> Concurrency-interest mailing list
>>> Concurrency-interest at cs.**oswego.edu<Concurrency-interest at cs.oswego.edu>
>>> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest>
>>>
>>>
>> ______________________________**_________________
>> Concurrency-interest mailing list
>> Concurrency-interest at cs.**oswego.edu <Concurrency-interest at cs.oswego.edu>
>> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest>
>>
>
> ______________________________**_________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.**oswego.edu <Concurrency-interest at cs.oswego.edu>
> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20130212/4265f894/attachment.html>


More information about the Concurrency-interest mailing list