Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2300634
  • 博文数量: 266
  • 博客积分: 5485
  • 博客等级: 大校
  • 技术积分: 3695
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-20 11:05
个人简介

多读书,多做事,广交朋友,趣味丛生

文章分类

全部博文(266)

分类: 系统运维

2011-09-11 11:30:25

主要的思路就是时间差,当时间差达到我们设定的时间值时,则执行批量更新操作:

private static long lastExecuteTime=0;//上次更新时间 
private static long executeSep=60000;//定义更新间隔时间,单位毫秒

long now = System.currentTimeMillis(); //获取当前系统时间
if ((now - lastExecuteTime) > executeSep) {

lastExecuteTime=now;

executeUpdate();  //执行更新操作

}

阅读(6335) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~