我想每隔一定时间更新对象属性(调用休息服务)。我有对象定义和一个带有new和set的类public class Obj { private String data; //Getters and setters}//A class with the new and sets:Public class setData{ public setData{ Obj o = new Obj(); o.setdata("hello"); } TimerTask timerTask = new MyTimerTask(); Timer timer = new Timer(true); timer.scheduleAtFixedRate(timerTask, 0, 10*1000);}public class MyTimerTask extends TimerTask { @Override public void run() {/* Here is the question. How can I update the data property of my object? I need to call the rest service, and update. The data string is on a swing UI. */ }}这是问题。如何更新对象的数据属性?我需要致电其余服务,并进行更新。数据字符串在swing UI上。
添加回答
举报
0/150
提交
取消