You should synchronize the check and the returning of the value. Theorerically it could be assigned in between by another thread.