[concurrency-interest] Primitives wrappers and visibility problems

Kasper Nielsen kav at it.edu
Wed Aug 23 05:45:43 EDT 2006


Peter Veentjer wrote:
> I have another question about visibility problems. Someone suggested
> to me that the primitve wrappers (like Integer) don't use a final
> field for the primitive they contain. This would make them not
> threadsafe. Is this correct?
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
> 

You could take a peek in the source:

     /**
      * The value of the <code>Integer</code>.
      *
      * @serial
      */
     private final int value;

     /**
      * Constructs a newly allocated <code>Integer</code> object that
      * represents the specified <code>int</code> value.
      *
      * @param   value   the value to be represented by the
      *			<code>Integer</code> object.
      */
     public Integer(int value) {
	this.value = value;
     }

- Kasper


More information about the Concurrency-interest mailing list