I want to run a function for each user with a session at regular intervals to check if the user is active. If it is inactive, the function will remove the user from the list of users in the context of the servlet and clear the user session.
What can I use to run the function at regular time intervals for each user?
From what I understand, servletcontextlistener is only started once for the life of the servlet, and not for each user, so it cannot be used. In addition, streams are recommended for servlets.
Edit: Users (using ajax) invoke an action that contains a function that updates the variable that I saved for each user, which indicates the last time they contacted the server.
source
share