use an AtomicLong for thread safety