New better way to walk the stack

The StackWalker class has four getInstance() static factory methods:

  • getInstance(): This returns a StackWalker class instance configured to skip all hidden frames and the caller class reference
  • getInstance(StackWalker.Option option): This creates a StackWalker class instance with the given option specifying the stack frame information it can access
  • getInstance(Set<StackWalker.Option> options): This creates a StackWalker class instance with the given set of options
  • getInstance(Set<StackWalker.Option> options, int estimatedDepth): This allows you to pass in the estimatedDepth parameter that specifies the estimated number of stack frames this instance will traverse so that the Java machine can allocate the appropriate ...

Get Java 9 High Performance now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.