应用有个需求,是定时去服务器获取一个账号是否有新的动态。
就像新浪微博那种,打开客户端,会自动提示有多少个 @ 。
Timer timer = new Timer(); timer.scheduleAtFixedRate( new TimerTask() { public void run() { try {
checkEvent();
Thread.sleep(1000);
} catch (Exception ie) {
}
}
}, 1000, 1000 * 30);我这样做会不会有什么风险?
求有经验的慕友分享一下。
慕慕森
红颜莎娜
相关分类