Ver a proveniência

[检查线程数][修改]:打印占用线程数

release
Stormeye Wu há 7 anos
ascendente
cometimento
2b2103170b
1 ficheiros alterados com 20 adições e 0 eliminações
  1. +20
    -0
      mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java

+ 20
- 0
mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java Ver ficheiro

@@ -283,10 +283,12 @@ public class WechatCalllbackController extends BaseController {
return;
}
} else {
getThreadCount( 0 );
// 公众号
WxMpService mpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId);
try {
WxMpXmlOutMessage outMessage = mpManager.getRouter(mpService).route(inMessage);
getThreadCount( 1 );
if (outMessage == null) {
this.logger.info("2 return: success");
printWriter.print("success");
@@ -307,6 +309,24 @@ public class WechatCalllbackController extends BaseController {
printWriter.close();
}

private void getThreadCount( int i) {
ThreadGroup group = Thread.currentThread().getThreadGroup();
ThreadGroup topGroup = group;
// 遍历线程组树,获取根线程组
while (group != null) {
topGroup = group;
group = group.getParent();
}
// 激活的线程数加倍
int estimatedSize = topGroup.activeCount() * 2;
Thread[] slackList = new Thread[estimatedSize];
// 获取根线程组的所有线程
int actualSize = topGroup.enumerate(slackList);
// copy into a list that is the exact size
logger.info("Thread list size == " + i + " : " + actualSize);

}

private void updateAuditStatus(String appId, boolean success, String reason) {




Carregando…
Cancelar
Guardar