Fixed a eclipse build issue and replace lock with AtomicLong

fixed a eclipse build NPE issue and replace lock with AtomicLong