Class ThrowableCallStack
java.lang.Object
org.apache.tomcat.dbcp.pool2.impl.ThrowableCallStack
- All Implemented Interfaces:
CallStack
CallStack strategy that uses the stack trace from a
Throwable. This strategy, while slower than the
SecurityManager implementation, provides call stack method names and other metadata in addition to the call stack
of classes.- Since:
- 2.4.3
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionThrowableCallStack(String messageFormat, boolean useTimestamp) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the current stack trace snapshot.voidTakes a snapshot of the current call stack.booleanprintStackTrace(PrintWriter writer) Prints the current stack trace if available to a PrintWriter.
-
Constructor Details
-
ThrowableCallStack
Create a new instance.- Parameters:
messageFormat- message formatuseTimestamp- whether to format the dates in the output message or not
-
-
Method Details
-
printStackTrace
Description copied from interface:CallStackPrints the current stack trace if available to a PrintWriter. The format is undefined and is primarily useful for debugging issues withPooledObjectusage in user code.- Specified by:
printStackTracein interfaceCallStack- Parameters:
writer- a PrintWriter to write the current 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:CallStackTakes a snapshot of the current call stack. Subsequent calls toCallStack.printStackTrace(PrintWriter)will print out that stack trace until it is cleared.- Specified by:
fillInStackTracein interfaceCallStack
-
clear
public void clear()Description copied from interface:CallStackClears the current stack trace snapshot. Subsequent calls toCallStack.printStackTrace(PrintWriter)will be no-ops until another call toCallStack.fillInStackTrace().
-