Reputation: 504
I've recently set up a Minecraft server for my friends and myself and I thought it would be a fun project to program my own maintenance wrapper for it, in which I periodically reboot, backup, and diagnose various aspects of the server.
I saw the ScheduledExecutorService class and figured it would be perfect, but I ran into a problem. I shut down my computer almost every night, and this class works on an elapsed time basis, and I would like to run some tasks only once a week. What would be the simplest way to implement this?
Is there another class I could use that automatically handles executing tasks based on actual time instead of elapsed time that I could use instead?
EDIT: I should add that I realize straightforward use of any standard class won't work. But it could easily be possible to save the next execution time to disk every time I execute a task and then recall the list when starting the wrapper back up the next time, allowing it to resume where it left off, more or less.
Upvotes: 0
Views: 165