Requesting a stack trace for a Java ThreadInfo?

I have an application that calls getStackTrace() on a java.lang.management.ThreadInfo object, but the StackTraceElement array produced by the invocation is zero length.

Inspecting the Javadoc shows this (emphasis mine):

public StackTraceElement[] getStackTrace()

Returns the stack trace of the thread associated with this ThreadInfo. If no stack trace was requested for this thread info, this method will return a zero-length array. If the returned array is of non-zero length then the first element of the array represents the top of the stack, which is the most recent method invocation in the sequence. The last element of the array represents the bottom of the stack, which is the least recent method invocation in the sequence.

How do I request a stack trace for this thread info?

Answers


How are you calling getThreadInfo()?

Are you specifying a stack trace depth?

getThreadInfo(long id, int maxDepth) Returns a thread info for a thread of the specified id, with stack trace of a specified number of stack trace elements.


Need Your Help

My function in jQuery shows a text in front of the output even though the function self already works

jquery wordpress function sidebar slug

I came up with an solution for not showing an sidebar in Wordpress when this is not filled with widgets. I did this by calling for the slug from the current page and named my sidebars the same as the

std::array of unknown size as a class member

c++ arrays

I'm making an N dimensional image format, I want to store the raw data in an

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.