Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identifying lambdas in stacktrace in Java 8

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:

profiler screenshot

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!

like image 783
Saliya Ekanayake Avatar asked Apr 03 '15 16:04

Saliya Ekanayake


1 Answers

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.

like image 65
Ingo Kegel Avatar answered Oct 23 '22 01:10

Ingo Kegel