Commit e5ac6ec5 by huluobin

亚马逊广告

parent 67d8e7e6
......@@ -42,7 +42,9 @@ public class AmazonAdDownloadReportJob implements SimpleJob {
@Override
public void execute(ShardingContext shardingContext) {
try (SqlSession sqlSession = SessionUtil.getFactory().openSession(true)) {
SqlSession sqlSession = SessionUtil.getFactory().openSession(true);
try {
JobAmazonAdLogMapper jobAmazonAdLogMapper = sqlSession.getMapper(JobAmazonAdLogMapper.class);
DcBaseCompanyAccountMapper dcBaseCompanyAccountMapper = sqlSession.getMapper(DcBaseCompanyAccountMapper.class);
......@@ -125,6 +127,8 @@ public class AmazonAdDownloadReportJob implements SimpleJob {
}
});
} finally {
sqlSession.close();
}
}
......
......@@ -57,7 +57,7 @@ public class SessionUtil {
}
//关闭session
public static void closeTranstionSession() {
public static void closeTranstionSession() {
try {
SqlSession session = threadLocalTransction.get();
if (session != null) {
......@@ -66,12 +66,12 @@ public class SessionUtil {
threadLocalTransction.set(null);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("MYSQL关闭Session异常",e);
throw new RuntimeException("MYSQL关闭Session异常", e);
}
}
//关闭session
public static void closeSession() {
public static void closeSession() {
try {
SqlSession session = threadLocal.get();
if (session != null) {
......@@ -80,7 +80,7 @@ public class SessionUtil {
threadLocal.set(null);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("MYSQL关闭Session异常",e);
throw new RuntimeException("MYSQL关闭Session异常", e);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment