I have recently written this answer:
Your problem has two distinct parts:
- How do I update user session attributes whenever I want to?
- How do I do something every 20 minutes?
For the first part, you just need to keep a collection of all current sessions that you can access from anywhere (i.e. without the need of having an
HttpServletRequest). This is answered in this post: How do I get a list of all HttpSession objects in a web application?
As you can see, the only thing my answer does is decompose the original question in two and provide links for each one of them. I think it wouldn't make sense to write a complete (i.e. not primarily link-based) answer when the problems have been solved already in other posts. I also cannot flag the question as a duplicate because it isn't really a duplicate of any of the two posts. So my question is: is an answer like that acceptable or should it be considered bad for being link-only?