(1)导入日志加入时间打印

(2)线程池等待sleep时间调整为10ms
This commit is contained in:
wangxin
2018-11-18 17:44:58 +08:00
parent 85123852b0
commit 97882ad05f
9 changed files with 413 additions and 11 deletions

View File

@@ -92,7 +92,6 @@ import com.nis.util.excel.thread.CheckDnsResStrategyFormatThread;
import com.nis.util.excel.thread.CheckIpFormatThread;
import com.nis.util.excel.thread.CheckStringFormatThread;
import com.nis.web.dao.configuration.IpCfgDao;
import com.nis.web.dao.configuration.WebsiteCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.ArchiveServcie;
import com.nis.web.service.AreaService;
@@ -875,7 +874,7 @@ public class BaseController {
service.shutdown();
while(!service.isTerminated()) {
try {
Thread.sleep(1000);
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -914,7 +913,7 @@ public class BaseController {
service.shutdown();
while(!service.isTerminated()) {
try {
Thread.sleep(1000);
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -953,7 +952,7 @@ public class BaseController {
service.shutdown();
while(!service.isTerminated()) {
try {
Thread.sleep(1000);
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -992,7 +991,7 @@ public class BaseController {
service.shutdown();
while(!service.isTerminated()) {
try {
Thread.sleep(1000);
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -1172,6 +1171,7 @@ public class BaseController {
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(1)) {// IP
if (regionDict.getFunctionId().equals(5)) {
if (serviceDict!=null&&serviceDict.getAction().equals(64)) {
@@ -1244,6 +1244,7 @@ public class BaseController {
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
String specServiceId = request.getParameter("appId");
String behaviorId = request.getParameter("behaviorId");
@@ -1286,7 +1287,33 @@ public class BaseController {
asnIpCfgService.processGroup(asnNoMaps.get(0));
//全量下发删除asnNo对应的已有的IP
if(isImportAll.get(0).getItemCode().equals("1")) {
logger.warn("Delete and send ip reuse regions start");
long _start=System.currentTimeMillis();
asnIpCfgService.deleteIps(asnNoMaps.get(1));
// List<Future<Throwable>> list=Lists.newArrayList();
// ExecutorService service=Executors.newFixedThreadPool(Constants.SAVE_AND_DEL_THREAD_SIZE);
// BlockingQueue<Long> queue=new ArrayBlockingQueue<>(asnNoMaps.get(1).size());
// queue.addAll(asnNoMaps.get(1).keySet());
// for(int j=0;j<Constants.SAVE_AND_DEL_THREAD_SIZE;j++) {
// DeleteAsnIpTread t=new DeleteAsnIpTread(queue);
// list.add(service.submit(t));
// }
// service.shutdown();
// while(!service.isTerminated()) {
// Thread.sleep(10);
// }
// for(Future<Throwable> e:list) {
// if(e.get()!=null) {
// try {
// throw e.get();
// } catch (Throwable e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
// }
// }
long _end=System.currentTimeMillis();
logger.warn("Delete and send ip reuse regions end,cost:"+(_end-_start));
}
Map<Long,Boolean> fullMap=Maps.newConcurrentMap();
for(Long asnNo:asnNoMaps.get(0).keySet()) {
@@ -1299,6 +1326,28 @@ public class BaseController {
}
fullMap.put(asnNo, info.getIsIssued().intValue()==1);
}
// List<Future<Throwable>> list=Lists.newArrayList();
// ExecutorService service=Executors.newFixedThreadPool(Constants.SAVE_AND_DEL_THREAD_SIZE);
// for(int j=0;j<Constants.SAVE_AND_DEL_THREAD_SIZE;j++) {
// SaveAsnIpThread t=new SaveAsnIpThread(serviceDict, regionDict, requestId, ipPortCfgs);
// t.setAsnNoMaps(asnNoMaps);
// t.setFullMap(fullMap);
// list.add(service.submit(t));
// }
// service.shutdown();
// while(!service.isTerminated()) {
// Thread.sleep(10);
// }
// for(Future<Throwable> e:list) {
// if(e.get()!=null) {
// try {
// throw e.get();
// } catch (Throwable e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
// }
// }
List<AsnIpCfg> asnIpCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!ipPortCfgs.isEmpty()) {
@@ -1345,7 +1394,6 @@ public class BaseController {
}else if(asnNoMaps.get(1).containsKey(Long.parseLong(_cfg.getUserRegion1()))) {
_cfg.setAsnIpGroup(asnNoMaps.get(1).get(Long.parseLong(_cfg.getUserRegion1())));
}else {
// ConfigGroupInfo info=asnIpCfgService.getConfigGroupInfoByAsnNo(Long.parseLong(_cfg.getUserRegion1()));
ConfigGroupInfo info=AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
if(info==null) {
info=asnIpCfgService.getConfigGroupInfoByAsnNo(Long.parseLong(_cfg.getUserRegion1()));