I have a question for your help with. My title of this question may not be to the point, or exactly reflects the problem I want to solve. But this is want I want to achieve in the problem:
I have a list of entities, i.e. a list of persons, each with a same set of attributes. I need to process them individually and sequentially. For instance, for each person, I need to send an email to him/her and the email will be sent at a fixed time (i.e. 12 PM every Wednesday) on a weekly basis. The logic roughly looks like this:
[code]
Person[] persons = new Person[10];
// In this week, I will take the first person and send an email to him
int i =0;
sendEmail(persons[i]);
// Then next week, it will send email to the next person
sendEmail(person[i++]);
[/code]
The problem is that the application isn't supposed to be running all the time(24/7). It may shut down anytime this week and next week. How can the problem resume to run from the state of the time when it was shut down last time?
Using database might be one option, but that will be too heavy for my task. Is there a type of "persistent" data structure or algorithm that can help do this?
I know this might be silly but if anyone can share some experiences or ideas, I would really appreciate!