Is it possible to use Timers in java?
Iwant to built the server which continuously keeps on checking the database for any updates available to notify for every five minutes. Is it possible to use timer for checking the database in the java as v can do in dot net. If anyone has idea to impl开发者_StackOverflow中文版ement it please share it with me.
Thanks in advance.
Yes sure it is possible. I hope you are asking about scheduling jobs
Timer timer = new Timer();
timer.schedule(new YourTask(), seconds * 1000);
Take a look at quartz scheduler for a more sophisticated approach.
You can schedule any operation in java using the Timer. You can also use Quartz Scheduler .
I would go for Spring scheduler.
Yes it is possible.
java.util.Timer
精彩评论