Simple STM implementation on Java