Use an AtomicLong for deviceKeyCounter.