1
yaohonv OP // 定义一个带定时的线程
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); |