Commit 2c0e85e6 by hxw2303632

正确关闭sql连接

parent bccbf33e
......@@ -124,12 +124,19 @@ public class ChatCacheController {
opFlag = helper.insertArchiveInfo(archiveName, userKey, site);
if(destroy)
if(destroy) {
helper.destroy();
destroy = false;
}
} catch (Exception e) {
System.out.println("游戏存档时发生异常");
opFlag = false;
}finally{
if(helper != null && destroy){
helper.destroy();
}
}
return opFlag;
......@@ -239,7 +246,7 @@ public class ChatCacheController {
String fileDir = System.getProperty("user.dir") + "/ChatCache";
Boolean findFlag = false;
SqlHelper helper;
SqlHelper helper = null;
Map<String, String> infoPoints = new HashMap<String, String>();
try {
......@@ -273,7 +280,7 @@ public class ChatCacheController {
System.out.println("sql:" + userKey);
archiveInfo = helper.queryUserLastGameArchive(userKey);
helper.destroy();
findFlag = (archiveInfo != null);
}
......@@ -281,6 +288,8 @@ public class ChatCacheController {
} catch (Exception e) {
e.printStackTrace();
findFlag = false;
} finally{
helper.destroy();
}
System.out.println("finalFlag" + findFlag);
......
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