 |
|
yaohonv
lighten my lights , lighten your code
V2EX member #7693, joined on 2011-04-07 14:12:44 +08:00
|
lighten my lights , lighten your code
yaohonv's recent replies
// 定义一个带定时的线程
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);