Browse Source

REPORT-15128 10.0本地设计 设计器卡死 转专人服务-Hanzhen

* commit '80707918f6053b6924973da8efb3520cf6fa77a6':
  换用ScheduledExecutorService schedule来延时发送
  http://www.finedevelop.com:2016/browse/REPORT-15128 lastTime刷新后,会导致功能点上传不上去
bugfix/10.0
Alex.Sung 6 years ago
parent
commit
65de6bc396
  1. 38
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

38
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -54,6 +54,9 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/** /**
* @author neil * @author neil
@ -181,12 +184,6 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
private void sendUserInfo(){ private void sendUserInfo(){
long currentTime = new Date().getTime();
long lastTime = getLastTimeMillis();
if (currentTime - lastTime <= DELTA) {
return;
}
JSONObject content = getJSONContentAsByte(); JSONObject content = getJSONContentAsByte();
String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10"); String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10");
boolean success = false; boolean success = false;
@ -204,13 +201,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
} }
private void sendFunctionsInfo(){ private void sendFunctionsInfo(long currentTime, long lastTime){
Date current = new Date();
long lastTime = getLastTimeMillis();
long currentTime = current.getTime();
if (currentTime - lastTime <= DELTA) {
return;
}
FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); FineLoggerFactory.getLogger().info("Start sent function records to the cloud center...");
queryAndSendOnePageFunctionContent(currentTime, lastTime, 0); queryAndSendOnePageFunctionContent(currentTime, lastTime, 0);
long page = (totalCount/PAGE_SIZE) + 1; long page = (totalCount/PAGE_SIZE) + 1;
@ -350,23 +341,22 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return; return;
} }
Thread sendThread = new Thread(new Runnable() { ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
service.schedule(new Runnable() {
@Override @Override
public void run() { public void run() {
try { long currentTime = new Date().getTime();
//读取XML的5分钟后开始发请求连接服务器. long lastTime = getLastTimeMillis();
Thread.sleep(SEND_DELAY); if (currentTime - lastTime > DELTA) {
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
sendUserInfo(); sendUserInfo();
sendFunctionsInfo(); sendFunctionsInfo(currentTime, lastTime);
}
TemplateInfoCollector.getInstance().sendTemplateInfo(); TemplateInfoCollector.getInstance().sendTemplateInfo();
ErrorInfoUploader.getInstance().sendErrorInfo(); ErrorInfoUploader.getInstance().sendErrorInfo();
} }
}); }, SEND_DELAY, TimeUnit.SECONDS);
sendThread.start();
} }
/** /**

Loading…
Cancel
Save