Use AtomicInteger instead sync block, fix multiinstance concurrency problem