Commit 59e1df60 authored by 周健威's avatar 周健威

修改代码

parent c645cf01
...@@ -104,34 +104,34 @@ public class GtDataRestClient { ...@@ -104,34 +104,34 @@ public class GtDataRestClient {
private ScheduledExecutorService scheduler; private ScheduledExecutorService scheduler;
@PostConstruct // @PostConstruct
public void init() { // public void init() {
try { // try {
login();// 第一次更新认证信息,在初始化时执行 // login();// 第一次更新认证信息,在初始化时执行
} catch (GtDataRestException e) { // } catch (GtDataRestException e) {
logger.warn("GtData login error. try again...", e); // logger.warn("GtData login error. try again...", e);
logout(defaultToken); // logout(defaultToken);
login(); // 异常时,再试一次更新认证信息 // login(); // 异常时,再试一次更新认证信息
} // }
int cpuCoreNumber = Runtime.getRuntime().availableProcessors();// cpu内核数 // int cpuCoreNumber = Runtime.getRuntime().availableProcessors();// cpu内核数
scheduler = Executors.newScheduledThreadPool(cpuCoreNumber); // scheduler = Executors.newScheduledThreadPool(cpuCoreNumber);
Runnable task = new Runnable() { // Runnable task = new Runnable() {
@Override // @Override
public void run() { // public void run() {
try { // try {
updateAuth(); // 更新认证信息 // updateAuth(); // 更新认证信息
} catch (GtDataRestException e) { // } catch (GtDataRestException e) {
logger.warn("GtData getSign error. try relogin...", e); // logger.warn("GtData getSign error. try relogin...", e);
logout(defaultToken); // logout(defaultToken);
login(); // 异常时,重新登陆 // login(); // 异常时,重新登陆
} // }
} // }
}; // };
Thread thread = new Thread(task); // Thread thread = new Thread(task);
thread.setDaemon(true); // thread.setDaemon(true);
scheduler.scheduleAtFixedRate(thread, 5L, 5L, TimeUnit.MINUTES);// 每5分钟执行一次 // scheduler.scheduleAtFixedRate(thread, 5L, 5L, TimeUnit.MINUTES);// 每5分钟执行一次
//
} // }
@PreDestroy @PreDestroy
public void dostory() { public void dostory() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment