asn统计updatesql,不分批次提交
This commit is contained in:
@@ -111,15 +111,11 @@ public class StatisticASNIpNumer {
|
|||||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||||
SqlSession batchSqlSession = null;
|
SqlSession batchSqlSession = null;
|
||||||
try {
|
try {
|
||||||
|
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, true);
|
||||||
for(Entry<Integer,Map<String,Long>> e: asnNumerMap.entrySet()) {
|
for(Entry<Integer,Map<String,Long>> e: asnNumerMap.entrySet()) {
|
||||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
|
||||||
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).updateIpNum(e.getValue().get("v4"),e.getValue().get("v6"),e.getKey());
|
((AsnGroupInfoDao) batchSqlSession.getMapper(AsnGroupInfoDao.class)).updateIpNum(e.getValue().get("v4"),e.getValue().get("v6"),e.getKey());
|
||||||
if(index!= 0 && index%20000==0){
|
|
||||||
batchSqlSession.commit();
|
|
||||||
}
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
batchSqlSession.commit();
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("修改ASN IP个数失败", e);
|
logger.error("修改ASN IP个数失败", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user