American Express Interview Question

How to handle race condition in Java.