|
@@ -51,16 +51,31 @@ public class RefreshThread extends Thread {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Date last_refresh_config = null;
|
|
|
+ Date last_refresh_physical_world = null;
|
|
|
while (!stop) {
|
|
|
try {
|
|
|
- Thread.sleep(1000L * 5);
|
|
|
+ Thread.sleep(1000L);
|
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
+ Date currTime = new Date();
|
|
|
try {
|
|
|
- boolean changed_config = Process_config();
|
|
|
- boolean changed_physical_world = this.Process_physical_world();
|
|
|
+ boolean changed_config = false;
|
|
|
+ if (last_refresh_config == null || currTime.getTime() - last_refresh_config.getTime() > 1000L * 60) {
|
|
|
+ if (Constant.config_download_enable) {
|
|
|
+ changed_config = Process_config();
|
|
|
+ }
|
|
|
+ last_refresh_config = currTime;
|
|
|
+ }
|
|
|
+ boolean changed_physical_world = false;
|
|
|
+ if (last_refresh_physical_world == null || currTime.getTime() - last_refresh_physical_world.getTime() > 1000L * 60 * 60) {
|
|
|
+ if (Constant.physical_world_download_enable) {
|
|
|
+ changed_physical_world = this.Process_physical_world();
|
|
|
+ }
|
|
|
+ last_refresh_physical_world = currTime;
|
|
|
+ }
|
|
|
if (changed_config || changed_physical_world) {
|
|
|
log.info("recompute begin");
|
|
|
Repository Repository = new Repository();
|
|
@@ -75,10 +90,6 @@ public class RefreshThread extends Thread {
|
|
|
}
|
|
|
|
|
|
private boolean Process_config() throws Exception {
|
|
|
- if (!Constant.config_download_enable) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
String validPath = Constant.getLatestPath(Constant.config, false);
|
|
|
File valid = new File(validPath);
|
|
|
|
|
@@ -97,10 +108,6 @@ public class RefreshThread extends Thread {
|
|
|
}
|
|
|
|
|
|
private boolean Process_physical_world() throws Exception {
|
|
|
- if (!Constant.physical_world_download_enable) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
String validPath = Constant.getLatestPath(Constant.physical_world, true);
|
|
|
// 存储临时文件
|
|
|
File dir1;
|