org.apache.commons.pool2.impl

## Class ThrowableCallStack

- java.lang.Object
- - org.apache.commons.pool2.impl.ThrowableCallStack

- All Implemented Interfaces:
    CallStack

      public class ThrowableCallStack
      extends Object
      implements CallStack

  CallStack strategy that uses the stack trace from a `Throwable`. While being the most portable method of obtaining the current call stack, this is also the slowest way to do it. In environments where a new SecurityManager can be created, it is preferred to use `SecurityManagerCallStack`.
  Since:
    2.4.3
  See Also:
    `Throwable.fillInStackTrace()`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ThrowableCallStack(String messageFormat, boolean useTimestamp)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clears the current stack trace snapshot.
    `void` | `fillInStackTrace()` Takes a snapshot of the current call stack.
    `boolean` | `printStackTrace(PrintWriter writer)` Prints the current stack trace if available to a PrintWriter.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ThrowableCallStack

          public ThrowableCallStack(String messageFormat,
                                    boolean useTimestamp)

  - ### Method Detail

    - #### printStackTrace

          public boolean printStackTrace(PrintWriter writer)

      Description copied from interface: `CallStack`
      Prints the current stack trace if available to a PrintWriter. The format is undefined and is primarily useful for debugging issues with `PooledObject` usage in user code.
      Specified by:
        `printStackTrace` in interface `CallStack`
      Parameters:
        `writer` - a PrintWriter to write the curren stack trace to if available
      Returns:
        true if a stack trace was available to print or false if nothing was printed

    - #### fillInStackTrace

          public void fillInStackTrace()

      Description copied from interface: `CallStack`
      Takes a snapshot of the current call stack. Subsequent calls to `CallStack.printStackTrace(PrintWriter)` will print out that stack trace until it is cleared.
      Specified by:
        `fillInStackTrace` in interface `CallStack`

    - #### clear

          public void clear()

      Description copied from interface: `CallStack`
      Clears the current stack trace snapshot. Subsequent calls to `CallStack.printStackTrace(PrintWriter)` will be no-ops until another call to `CallStack.fillInStackTrace()`.
      Specified by:
        `clear` in interface `CallStack`

Copyright © 2001–2017 The Apache Software Foundation. All rights reserved.