Commit dd66ed3b by fukai

完善数据库连接释放

parent d57feb91
...@@ -140,7 +140,10 @@ public abstract class AbstractCommonController { ...@@ -140,7 +140,10 @@ public abstract class AbstractCommonController {
ret = ResultUtil.result(ErrorCodes.ERROR, "hander error", e.getMessage()); ret = ResultUtil.result(ErrorCodes.ERROR, "hander error", e.getMessage());
} finally { } finally {
if (context != null) if (context != null)
{
context.getSupport().disconnect();
context.dispose(); context.dispose();
}
} }
return ret; return ret;
......
...@@ -44,7 +44,7 @@ public class LoginController { ...@@ -44,7 +44,7 @@ public class LoginController {
@RequestMapping(value = "/login", method = RequestMethod.POST) @RequestMapping(value = "/login", method = RequestMethod.POST)
public Object login(@RequestBody Map<String, Object> dataMap, HttpServletRequest request, HttpSession session) { public Object login(@RequestBody Map<String, Object> dataMap, HttpServletRequest request, HttpSession session) {
// TODO??? // TODO???
System.out.println(dataMap); //System.out.println(dataMap);
NoUiRequest noUiRequest = new NoUiRequest(request, "", dataMap); NoUiRequest noUiRequest = new NoUiRequest(request, "", dataMap);
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String userId = noUiRequest.getDataMap().get(Constants.USERNAME).toString(); String userId = noUiRequest.getDataMap().get(Constants.USERNAME).toString();
...@@ -86,7 +86,15 @@ public class LoginController { ...@@ -86,7 +86,15 @@ public class LoginController {
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Login command error", e); log.error("Login command error", e);
throw new NoUiException("Login command error", e); //throw new NoUiException("Login command error", e);
return ResultUtil.result(ErrorCodes.ERROR, "login failed with exception", null);
}
finally{
if (context != null)
{
context.getSupport().disconnect();
context.dispose();
}
} }
log.debug("Login command is finished"); log.debug("Login command is finished");
return ResultUtil.result(ErrorCodes.ERROR, "login failed", null); return ResultUtil.result(ErrorCodes.ERROR, "login failed", null);
......
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