@Override public void run() { Set<Long> sessionIds = new HashSet<Long>(); Long sessionId; do { sessionId = queue.poll(); if (sessionId != null) { sessionIds.add(sessionId); } } while (sessionId != null); if (!sessionIds.isEmpty()) { ssoService.touchSessions(new ArrayList<Long>(sessionIds)); } } }