1.top 命令 找到占用CPU高的java进程的PID
>> 例如 pid为 146780
2. 打出高cup的线程栈
jstack 146780> 146780.txt
3. 找到这个进程高cpu的线程
top -p 146780 -H
>> 例如 线程号 为 105080
4. 将线程号转化为 16进制
printf "%x" 105080
>> 19a78
4. 在146780.txt 文件中找到对应的线程
"JobRunnerPool-thread-28" #473 prio=5 os_prio=0 tid=0x00007f86e4002800 nid=0x19a78 runnable [0x00007f87b3cfa000]
java.lang.Thread.State: RUNNABLE
at com.ecovacs.moa.util.MdbElinkUtil.getCompareDeptName(MdbElinkUtil.java:299)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl.lambda$resetDeptDataFromELink$7_aroundBody44(NotifyElinkOrgDeptServiceImpl.java:353)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl$AjcClosure45.run(NotifyElinkOrgDeptServiceImpl.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.qbao.cat.plugin.DefaultPluginTemplate.proxyCollector(DefaultPluginTemplate.java:71)
at com.qbao.cat.plugin.DefaultPluginTemplate.doAround(DefaultPluginTemplate.java:64)
at com.qbao.cat.plugin.spring.SpringServicePluginTemplate.doAround(SpringServicePluginTemplate.java:31)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl.lambda$resetDeptDataFromELink$7(NotifyElinkOrgDeptServiceImpl.java:353)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl$$Lambda$39/1807707298.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl.resetDeptDataFromELink_aroundBody22(NotifyElinkOrgDeptServiceImpl.java:352)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl$AjcClosure23.run(NotifyElinkOrgDeptServiceImpl.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.qbao.cat.plugin.DefaultPluginTemplate.proxyCollector(DefaultPluginTemplate.java:71)
at com.qbao.cat.plugin.DefaultPluginTemplate.doAround(DefaultPluginTemplate.java:64)
at com.qbao.cat.plugin.spring.SpringServicePluginTemplate.doAround(SpringServicePluginTemplate.java:31)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl.resetDeptDataFromELink(NotifyElinkOrgDeptServiceImpl.java:345)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl$$FastClassBySpringCGLIB$$e4da6e3.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at com.ecovacs.moa.service.notifyelink.impl.NotifyElinkOrgDeptServiceImpl$$EnhancerBySpringCGLIB$$bf9c322b.resetDeptDataFromELink(<generated>)
at com.ecovacs.moa.mgr.task.notifyelink.PullMdbOrgDataTask.doTask_aroundBody0(PullMdbOrgDataTask.java:38)
at com.ecovacs.moa.mgr.task.notifyelink.PullMdbOrgDataTask$AjcClosure1.run(PullMdbOrgDataTask.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.qbao.cat.plugin.DefaultPluginTemplate.proxyCollector(DefaultPluginTemplate.java:71)
at com.qbao.cat.plugin.DefaultPluginTemplate.doAround(DefaultPluginTemplate.java:64)
at com.qbao.cat.plugin.ecovacs.TaskPluginTemplate.doAround(TaskPluginTemplate.java:29)
at com.ecovacs.moa.mgr.task.notifyelink.PullMdbOrgDataTask.doTask(PullMdbOrgDataTask.java:35)
at com.ecovacs.moa.mgr.task.BaseTask.run(BaseTask.java:13)
at com.ecovacs.moa.mgr.task.TaskManager.runTask(TaskManager.java:59)
at com.ecovacs.moa.mgr.task.JobRunnerDispatcher.run(JobRunnerDispatcher.java:30)
at com.github.ltsopensource.tasktracker.runner.JobRunnerDelegate.run(JobRunnerDelegate.java:86)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
打印dump文件