(1)asn no放入eCache中
(2)导入验证采用多线程验证,优化验证速度 (3)asn ip导入方式调整(未采用多线程,因为redis承受不了) (4)asn ip列表展示速度优化 (5)导入方式重写:采用csv模式,限制采用xlsx格式,加载80万数据不会内存溢出.
This commit is contained in:
@@ -105,10 +105,16 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
// int batchSize=1000;
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
T t = data.get(index);
|
||||
((CrudDao<T>) batchSqlSession.getMapper(mClass)).insert(t);
|
||||
// if(index>0&&index%batchSize==0) {
|
||||
// batchSqlSession.commit();
|
||||
// batchSqlSession.clearCache();
|
||||
// logger.warn("session commit");
|
||||
// }
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
|
||||
Reference in New Issue
Block a user