抽取公共方法,重构代码逻辑
This commit is contained in:
@@ -1,75 +1,22 @@
|
||||
package cn.ac.iie.test;
|
||||
|
||||
import cn.ac.iie.dao.BaseArangoData;
|
||||
import cn.ac.iie.dao.BaseClickhouseData;
|
||||
import cn.ac.iie.utils.ArangoDBConnect;
|
||||
import cn.ac.iie.utils.ExecutorThreadPool;
|
||||
import cn.ac.iie.dao.UpdateGraphData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class IpLearningApplicationTest {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(IpLearningApplicationTest.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
LOG.info("Ip Learning Application开始运行");
|
||||
BaseArangoData baseArangoData = new BaseArangoData();
|
||||
baseArangoData.baseDocumentDataMap();
|
||||
|
||||
long startA = System.currentTimeMillis();
|
||||
BaseArangoData.BaseVFqdnDataMap();
|
||||
BaseArangoData.BaseVIpDataMap();
|
||||
BaseArangoData.BaseEFqdnAddressIpDataMap();
|
||||
BaseArangoData.BaseEIpVisitFqdnDataMap();
|
||||
|
||||
|
||||
ExecutorThreadPool.shutdown();
|
||||
ExecutorThreadPool.awaitThreadTask();
|
||||
long lastA = System.currentTimeMillis();
|
||||
LOG.info("读取ArangoDb时间:"+(lastA - startA));
|
||||
|
||||
long startC = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(4);
|
||||
|
||||
new Thread(() -> {
|
||||
BaseClickhouseData.BaseVFqdn();
|
||||
countDownLatch.countDown();
|
||||
}).start();
|
||||
|
||||
new Thread(() -> {
|
||||
BaseClickhouseData.BaseVIp();
|
||||
countDownLatch.countDown();
|
||||
}).start();
|
||||
|
||||
new Thread(() -> {
|
||||
BaseClickhouseData.BaseEFqdnAddressIp();
|
||||
countDownLatch.countDown();
|
||||
}).start();
|
||||
|
||||
new Thread(() -> {
|
||||
BaseClickhouseData.BaseEIpVisitFqdn();
|
||||
countDownLatch.countDown();
|
||||
}).start();
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
LOG.info("主线程等待完毕");
|
||||
}catch (Exception e){
|
||||
LOG.error("主线程阻塞异常:\n"+e.toString());
|
||||
}
|
||||
|
||||
long lastC = System.currentTimeMillis();
|
||||
LOG.info("更新ArangoDb时间:"+(lastC - startC));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
ArangoDBConnect.clean();
|
||||
}
|
||||
|
||||
LOG.info("v_Fqdn_Map大小:"+BaseArangoData.v_Fqdn_Map.size());
|
||||
LOG.info("v_Ip_Map大小:"+BaseArangoData.v_Ip_Map.size());
|
||||
LOG.info("e_Fqdn_Address_Ip_Map大小:"+BaseArangoData.e_Fqdn_Address_Ip_Map.size());
|
||||
LOG.info("e_Ip_Visit_Fqdn_Map大小:"+BaseArangoData.e_Ip_Visit_Fqdn_Map.size());
|
||||
LOG.info("历史数据读取完成,开始更新数据");
|
||||
UpdateGraphData updateGraphData = new UpdateGraphData();
|
||||
updateGraphData.updateArango();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user