Commit 7b602b97 authored by yanzg's avatar yanzg

异常处理显示

parent 09b61120
...@@ -68,12 +68,10 @@ public class WebAspect extends BaseRequestAspect { ...@@ -68,12 +68,10 @@ public class WebAspect extends BaseRequestAspect {
// 用户数据库记录 // 用户数据库记录
long start = requestLog(TAG, joinPoint); long start = requestLog(TAG, joinPoint);
Exception ex = null; Exception ex = null;
Ref<Boolean> flag = new Ref<>(false);
boolean isInit = false; boolean isInit = false;
try { try {
isInit = tokenServiceCall.tokenInit(); isInit = tokenServiceCall.tokenInit();
result = executeMethod(joinPoint); result = executeMethod(joinPoint);
tokenFinish(flag);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
ex = e; ex = e;
...@@ -84,8 +82,8 @@ public class WebAspect extends BaseRequestAspect { ...@@ -84,8 +82,8 @@ public class WebAspect extends BaseRequestAspect {
throw e; throw e;
} }
} finally { } finally {
tokenServiceCall.tokenFinish();
if (isInit) { if (isInit) {
tokenFinish(flag);
TokenHelper.remove(); TokenHelper.remove();
} }
responseLog(logWeb, clear, TAG, HttpAspectUtil.getHttpRequestUrl(), joinPoint, start, result, ex); responseLog(logWeb, clear, TAG, HttpAspectUtil.getHttpRequestUrl(), joinPoint, start, result, ex);
...@@ -101,19 +99,6 @@ public class WebAspect extends BaseRequestAspect { ...@@ -101,19 +99,6 @@ public class WebAspect extends BaseRequestAspect {
return this.applicationName.matches(this.gateWay); return this.applicationName.matches(this.gateWay);
} }
/**
* 执行结束函数
*
* @param flag 结束函数
* @return 结束函数
*/
private void tokenFinish(Ref<Boolean> flag) {
if (flag.value == true) {
return;
}
flag.value = true;
tokenServiceCall.tokenFinish();
}
/** /**
* 获取返回的至类型 * 获取返回的至类型
......
...@@ -52,27 +52,25 @@ public class TokenServiceCall implements TokenLoad { ...@@ -52,27 +52,25 @@ public class TokenServiceCall implements TokenLoad {
*/ */
public boolean tokenInit() { public boolean tokenInit() {
init(); init();
addHave();
if (tokenService == null) { if (tokenService == null) {
return false; return false;
} }
if (addHave(0) == 1) { if (addHave() == 1) {
return false;
}
tokenService.tokenInit(); tokenService.tokenInit();
return true; return true;
} }
return false;
}
/** /**
* 请求时结束token * 请求时结束token
*/ */
public void tokenFinish() { public void tokenFinish() {
init(); init();
subHave();
if (tokenService == null) { if (tokenService == null) {
return; return;
} }
if (addHave(0) == 0) { if (subHave() == 0) {
tokenService.tokenFinish(); tokenService.tokenFinish();
} }
} }
......
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