The class AtomicInteger permits to modify a variable in an atomic way, and the method set() has an happens-before relationship with the subsequent calls to the get() method.