[concurrency-interest] Joda-Time immutability

Stephen Colebourne scolebourne at joda.org
Mon Jun 20 19:46:17 EDT 2011


On 21 June 2011 00:41, David Holmes <davidcholmes at aapt.net.au> wrote:
> Stephen Colebourne writes:
>> Does this work?
>>
>> class DateTime extends BaseDateTime {
>>  private transient volatile fixBadDesign;
>>
>>  publc DateTime(long millis) {
>>    super(millis);
>>    fixbadDesign = this;
>>    DateTime fixed = fixbadDesign;
>>  }
>>
>> }
>
> No, writing to a volatile is not sufficient. As I said previously writing a
> final field might suffice.

Thanks. Not sure if writing "this" to a "final" field is a useful solution yet.

Stephen



More information about the Concurrency-interest mailing list