• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Session: getLastAccessedTime()

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the client’s been gone a long time and if I want to send them an email asking if they’re coming back or not.

Where do implement this?

The session object is retrieved from the request object.
If the client does not make any request for a long time, How to get the session object?
Is there any way to get list of all session objects and iterate?

Thanks
Kathir
 
Marshal
Posts: 6369
1123
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on Session objects is not a good practice for here. Because you need a data storage for a long time to approach this task.

Here, as the best solution, you can persist the last accessed time of each user to a database, so you can track it up anytime. For an example, if you are using a table named "Users" which contains some columns like "Name", "Password", ..... then you can insert another column as LastAccessedTime. (Or use this on another table, which is having a relationship with the Users table).

To send email notifications, you can use Timers or any other timed-method, so you can retrieve the users who didn't log-in for a long time. This can be done through an SQL statement or any other query language.

Cheers,

Devaka.
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks

So, Do I need a process running in loop and checking the database with specific interval ?

Kathir
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!