Class ThrowableCallStack
- java.lang.Object
-
- org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.ThrowableCallStack
-
- All Implemented Interfaces:
CallStack
public class ThrowableCallStack extends java.lang.Object implements CallStack
CallStack strategy that uses the stack trace from aThrowable
. 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:
Throwable.fillInStackTrace()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ThrowableCallStack.Snapshot
A snapshot of a throwable.
-
Field Summary
Fields Modifier and Type Field Description private java.text.DateFormat
dateFormat
private java.lang.String
messageFormat
private ThrowableCallStack.Snapshot
snapshot
-
Constructor Summary
Constructors Constructor Description ThrowableCallStack(java.lang.String messageFormat, boolean useTimestamp)
Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the current stack trace snapshot.void
fillInStackTrace()
Takes a snapshot of the current call stack.boolean
printStackTrace(java.io.PrintWriter writer)
Prints the current stack trace if available to a PrintWriter.
-
-
-
Field Detail
-
messageFormat
private final java.lang.String messageFormat
-
dateFormat
private final java.text.DateFormat dateFormat
-
snapshot
private volatile ThrowableCallStack.Snapshot snapshot
-
-
Method Detail
-
printStackTrace
public boolean printStackTrace(java.io.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 withPooledObject
usage in user code.- Specified by:
printStackTrace
in 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:CallStack
Takes a snapshot of the current call stack. Subsequent calls toCallStack.printStackTrace(PrintWriter)
will print out that stack trace until it is cleared.- Specified by:
fillInStackTrace
in interfaceCallStack
-
clear
public void clear()
Description copied from interface:CallStack
Clears the current stack trace snapshot. Subsequent calls toCallStack.printStackTrace(PrintWriter)
will be no-ops until another call toCallStack.fillInStackTrace()
.
-
-