[concurrency-interest] Assignment of references atomic?

Ryan LeCompte Ryan.LeCompte at pangonetworks.com
Wed Oct 12 07:59:42 EDT 2005


Hello all,

I know that assignment of doubles are potentially unsafe since they are 64 bits, but I was wonder if assignment of object references are atomic in J2SE 1.4.2 and J2SE 5.0? For example, is it safe to do the following without synchronizing the methods:

Object getObject() {

   return object;

}

 

void setObject(Object o) {

   callAnotherMethod();

   if (someCondition == true) {

      callAnotherMethod();

      this.object = o;

   }

}

Thanks,

Ryan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20051012/5af705f7/attachment.htm


More information about the Concurrency-interest mailing list