Made method synchronized.