Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserStats {
- private Map<String, AtomicLong> hitsPerUser = new ConcurrentHashMap<>()
- private void onUserCall(String userId) {
- if (userId == null) {
- return;
- }
- hitsPerUser.putIfAbsent(userId, new AtomicLong());
- hitsPerUser.get(userId).addAndGet(1L);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment