[concurrency-interest] Assignment of references atomic?

Mike Skells mike.skells at ebizz-consulting.com
Wed Oct 12 10:11:30 EDT 2005

Without doing something it is certainly unsafe unless the object is
volatile, as there is nothing to force the object to be written or read from
the global address space, so the object references could be assigning and
rading data from the thread cache only
Object references are I believe atomic according the the JLS, bu the that
does not make it threadsafe.
I think that you need to explain in a little more detail what you expect the
bahavior to be


From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu] On Behalf Of Ryan
Sent: 12 October 2005 13:00
To: concurrency-interest at altair.cs.oswego.edu
Subject: [concurrency-interest] Assignment of references atomic?

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) {


   if (someCondition == true) {


      this.object = o;





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

More information about the Concurrency-interest mailing list