JAVA 类似于定时器的功能

每天晚上11点固定时间 对数据库进行查询。得到排行榜前三。对前三名进行积分累加。
这功能要怎么实现呢?

public static void main()
{
while(true)
{
if(timeNow.ToString("HH:mm:ss").equal("23:00:00"))
{
SqlSelect();
}
}
}
private void SqlSelect()
{
String queryStr="select deptno, ename, sal

from emp e1

where

(

select count(1)

from emp e2

where e2.deptno=e1.deptno and e2.sal>=e1.sal

) <=3 /*这里的数值表示你想取前几名*/

order by deptno, sal desc";
//add other code....
}

http://blog.csdn.net/xionglangs/article/details/50819252,看下这个,把里面的那个每次执行时间算好就可以了。

http://blog.csdn.net/chenssy/article/details/32703499
定时任务。

Quartz是一个完全由Java编写的开源作业调度框架,
http://blog.csdn.net/huihuimimi17/article/details/8215779

用过的就只有timer了,不过不是太好用。