I have an application that calls getStackTrace() on a java.lang.management.ThreadInfo object, but the StackTraceElement array created by the call is zero.
A Javadoc check reveals this (primary focus):
public StackTraceElement[] getStackTrace()
Gets the stack trace of the thread associated with this ThreadInfo. If no stack trace was requested for this stream information, this method returns an array with a zero length . If the returned array has a nonzero length, then the first element of the array is the top of the stack, which is the most recent method call in the sequence. The last element of the array is the bottom of the stack, which is the least recent method call in a sequence.
How to request a stack trace for this thread info?
source share