Top Description Inners Fields Constructors Methods
org.apache.commons.pool2.impl

public Class ThrowableCallStack

extends Object
implements CallStack
Class Inheritance
All Implemented Interfaces
org.apache.commons.pool2.impl.CallStack
Imports
java.io.PrintWriter, java.text.DateFormat, .SimpleDateFormat

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
Throwable#fillInStackTrace()

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ThrowableCallStack.Snapshot

A snapshot of a throwable.

Field Summary

Modifier and TypeField and Description
private final DateFormat
private final String
private volatile ThrowableCallStack.Snapshot

Constructor Summary

AccessConstructor and Description
public
ThrowableCallStack(final String
message format
messageFormat
,
final boolean
whether to format the dates in the output message or not
useTimestamp
)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements org.apache.commons.pool2.impl.CallStack.clear.

Clears the current stack trace snapshot.
public void
fillInStackTrace()

Implements org.apache.commons.pool2.impl.CallStack.fillInStackTrace.

Takes a snapshot of the current call stack.
public synchronized boolean
printStackTrace(final PrintWriter
a PrintWriter to write the current stack trace to if available
writer
)

Implements org.apache.commons.pool2.impl.CallStack.printStackTrace.

Prints the current stack trace if available to a PrintWriter.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dateFormatback to summary
private final DateFormat dateFormat
messageFormatback to summary
private final String messageFormat
snapshotback to summary
private volatile ThrowableCallStack.Snapshot snapshot

Constructor Detail

ThrowableCallStackback to summary
public ThrowableCallStack(final String messageFormat, final boolean useTimestamp)

Creates a new instance.

Parameters
messageFormat:String

message format

useTimestamp:boolean

whether to format the dates in the output message or not

Method Detail

clearback to summary
public void clear()

Implements org.apache.commons.pool2.impl.CallStack.clear.

Doc from org.apache.commons.pool2.impl.CallStack.clear.

Clears the current stack trace snapshot. Subsequent calls to printStackTrace(PrintWriter) will be no-ops until another call to fillInStackTrace().

Annotations
@Override
fillInStackTraceback to summary
public void fillInStackTrace()

Implements org.apache.commons.pool2.impl.CallStack.fillInStackTrace.

Doc from org.apache.commons.pool2.impl.CallStack.fillInStackTrace.

Takes a snapshot of the current call stack. Subsequent calls to printStackTrace(PrintWriter) will print out that stack trace until it is cleared.

Annotations
@Override
printStackTraceback to summary
public synchronized boolean printStackTrace(final PrintWriter writer)

Implements org.apache.commons.pool2.impl.CallStack.printStackTrace.

Doc from org.apache.commons.pool2.impl.CallStack.printStackTrace.

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.

Parameters
writer:PrintWriter

a PrintWriter to write the current stack trace to if available

Returns:boolean

true if a stack trace was available to print or false if nothing was printed

Annotations
@Override
org.apache.commons.pool2.impl back to summary

private Class ThrowableCallStack.Snapshot

extends Throwable
Class Inheritance

A snapshot of a throwable.

Field Summary

Modifier and TypeField and Description
private static final long
private final long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Throwable:
addSuppressedfillInStackTracegetCausegetLocalizedMessagegetMessagegetStackTracegetSuppressedinitCauseprintStackTraceprintStackTraceprintStackTracesetStackTracetoString

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Throwable.serialVersionUID.

timestampMillisback to summary
private final long timestampMillis

Constructor Detail

Snapshotback to summary
private Snapshot()