// List of active sessions Id for which need to send ping
private List<Long> activeSessionIds = new ArrayList<>();
sessionKeepAliveTask = scheduledExecutorService.scheduleAtFixedRate(() -> {
log.info("Sending ping for all active sessions");
var t1 = System.currentTimeMillis();
this.activeSessionIds.forEach((sessionId) -> {
try {
this.sendKeepalive(sessionId);
} catch (Exception e) {
log.error("Error occurred while sending ping for session: {}", sessionId);
}
});
var t2 = System.currentTimeMillis();
log.info("Time taken for sending ping for {} sessions: {}", activeSessionIds.size(), (t2-t1));
}, 1L, 25, TimeUnit.SECONDS);
中的值
activeSessionIds
你知道我在这里遗漏了什么吗?