Yes, like that, thanks, Paul. > On Jun 15, 2018, at 11:01 AM, Brent Christian <brent.christ...@oracle.com> > wrote: > > On 6/15/18 10:35 AM, Paul Sandoz wrote: >> I would also publish the map in readHashtable after you have placed in the >> keys/values. > > Like this? > > // create CHM of appropriate capacity > - map = new ConcurrentHashMap<>(elements); > + ConcurrentHashMap<Object,Object> tmpMap = new > ConcurrentHashMap<>(elements); > > // Read all the key/value objects > for (; elements > 0; elements--) { > Object key = s.readObject(); > Object value = s.readObject(); > - map.put(key, value); > + tmpMap.put(key, value); > } > + > + UNSAFE.putObjectVolatile(this, MAP_OFFSET, tmpMap); > } > > -B
- RFR 8199435 : Unsafe publication of java.util.Properties.m... Brent Christian
- Re: RFR 8199435 : Unsafe publication of java.util.Pro... Paul Sandoz
- Re: RFR 8199435 : Unsafe publication of java.util... Brent Christian
- Re: RFR 8199435 : Unsafe publication of java.... Paul Sandoz
- Re: RFR 8199435 : Unsafe publication of java.util.Pro... Peter Levart
- Re: RFR 8199435 : Unsafe publication of java.util.Pro... David Holmes
- Re: RFR 8199435 : Unsafe publication of java.util... Claes Redestad
- Re: RFR 8199435 : Unsafe publication of java.... Peter Levart
- Re: RFR 8199435 : Unsafe publication of j... Claes Redestad
- Re: RFR 8199435 : Unsafe publication... Claes Redestad
- Re: RFR 8199435 : Unsafe publica... Peter Levart
- Re: RFR 8199435 : Unsafe pub... Claes Redestad
- Re: RFR 8199435 : Unsafe pub... Peter Levart
- Re: RFR 8199435 : Unsafe pub... Claes Redestad