|
|
yaohonv
lighten my lights , lighten your code
V2EX 第 7693 号会员,加入于 2011-04-07 14:12:44 +08:00
|
lighten my lights , lighten your code
yaohonv 最近回复了
// 定义一个带定时的线程
final ScheduledExecutorService timer = Executors
.newScheduledThreadPool(1);
final Runnable beeper = new Runnable() {
public void run() {
if (shell.isDisposed())
timer.shutdown();
display.syncExec(new Runnable() {
public void run() {
DirectMessageParam temp = ConWeibo
.getNearDirectMessage(weibo,
dmp.getNearestID(), 1375764302);
if (null != temp) {
text1.insert(temp.getContent() + "\r\n");
dmp = temp;
}
}
});
}
};
timer.scheduleAtFixedRate(beeper, 1, 5, TimeUnit.SECONDS);