Fine-Grained Stack Tracing

In the last chapter, we explored the Process class and the java.lang.ProcessHandle API. In earlier versions of Java, process management from within Java required OS-specific implementations and was less than optimal in terms of CPU use and coding practice. The modern API, with new classes such as ProcessHandle, makes it possible to handle almost all aspects of process management. Specifically, we covered an introduction to processes, working with the ProcessHandle interface, and reviewed a sample process controller application.

In this chapter, we will focus on Java's StackWalker API. The API supports special functionality that is rarely needed by ordinary programs. The API can be useful for some very special cases, such as with functionality that is delivered by a framework. So, if you want an efficient means of stack walking that gives you filterable access to stack trace information, you will enjoy using the StackWalker API. The API provides fast and optimized access to the call stack, implementing lazy access to the individual frames.

Specifically, we will cover the following topics:

  • Overview of the Java Stack
  • The importance of stack information
  • Working with StackWalker
  • StackFrame
  • Performance
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset