Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

periodic database purge - advice needed

  • 02-01-2012 5:09pm
    #1
    Registered Users, Registered Users 2 Posts: 1,180 ✭✭✭


    Hi i am currently creating a java server which stores user data in a mysql database. I would like to keep data somewhat fresh, so i was hoping that every 5 minutes, to have a thread poll the database, and remove any data from users which have been inactive in the past 5 minutes or so

    i just wondering what (experienced)peoples opinions are on an efficient way to do this. my idea was to have the thread sleep for 5 minutes before polling the DB again. is it possible to have a script in PL\SQL run every 5 minutes to do this?

    also will there be a contention issue for the database, i.e. what if the server is inputting data at the exact same time the purging thread is deleting data from the same table

    i am fairly good with java, however as you may notice i lack real world experience, so i'm open to all opinions :)


Comments

  • Registered Users, Registered Users 2 Posts: 2,013 ✭✭✭lynchie


    Possibilities are

    java.util.concurrent.ScheduledThreadPoolExecutor
    java.util.Timer

    or use something more featured such as Quartz


  • Registered Users, Registered Users 2 Posts: 15,065 ✭✭✭✭Malice


    Is there a particular reason why you need to remove data at such short intervals? Could you read the user from the database, store it somewhere e.g. in a HTTP session and then wipe that instead?


Advertisement