use atomic integer to replace synchronized primitive to avoid performance penalty