American Express interview question

How to handle race condition in Java.