Identifying lambdas in stacktrace in Java 8

偶尔善良 提交于 2019-11-27 06:11:27

问题


I am trying to profile a Java application that uses lambdas using JProfiler. I am having trouble identifying, which lambda the profiler is showing as a hotspot:

I would appreciate any help on understanding the format of the stack trace involving lambdas like "edu.indiana.soci.spidal.vectorclass.lambda$PairwiseThread_SecDrv$23"

Thank you!


回答1:


Unfortunately, there is no direct way to identify the lambda because lambdas by nature have no name. At runtime, lambdas are currently implemented with anonymous classes. They are numbered sequentially after the $ sign with respect to the containing class.

If you turn on line number resolution in JProfiler (session settings-> profiling settings tab-> customize-> check box on the "method call recording" tab), you will see a line number on the "run" method in the hot spot back trace which should help you to find the lambda if it's the only lambda on that line.



来源:https://stackoverflow.com/questions/29435888/identifying-lambdas-in-stacktrace-in-java-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!