Use an AtomicLong for deviceKeyCounter.
Merge pull request #403 from vy/patch-4

Use an AtomicLong for deviceKeyCounter.