Re: Class to run in future!
Hello, if I understand this correctly I'd say you should have all your actions created and then have a job/thread running on you server that checks the actions every 10 minutes or whatever your requirement might be. If an action is due to be run you run it.
// Json
Re: Class to run in future!
Hi!
Thanks for your answer.
The action I want to to is set to a certain day at a certain time.
Example: On a webpage the user sets a day and time to do the action. At that day and time, the server executes the action. I just need to call a function.
My doubt is how can I achieve this...
After the user sets date and time should I start a thread?? The thread will keep checking current date and time.
Re: Class to run in future!
Like I said before, I think you should start a thread when you start your web application. This thread could then run all the time and every minute or so just look at the list of actions and if the current time is after the time to run the action, then run it.
// Json
Re: Class to run in future!
You can use Timer API to schedule your task on time provided by the user.Timer (Java 2 Platform SE v1.4.2)