Where is sun.misc.Unsafe documented? [closed]
Solution 1:
There is a nice post about it on mishadoff's blog here.
The class is officially undocumented though.
Solution 2:
Regarding the putOrdered methods..
You can call this method to set the volatile field without using a volatile store.. If you execute a volatile store, you basically have a store memory barrier which ensures that all store instruction prior the barrier, happen before barrier and that memory is visible by ensuring the data is propagated to the cache sub-system.. So when you have the volatile store you must wait for the store buffer to drain.. With putOrdered thread executing will not wait for the store buffer to drain and this can improve performance.. However as a consequence stored value will not be visible to other threads immediately..
If you have a look on AtomicLong (or other Atomic classes) there is a lazySet method that actually executes putOrderedLong. The javadoc on this method is:
Eventually sets to the given value.