Class SecurityManagerCallStack
- java.lang.Object
-
- org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.SecurityManagerCallStack
-
- All Implemented Interfaces:
CallStack
public class SecurityManagerCallStack extends java.lang.Object implements CallStack
CallStack strategy using aSecurityManager. Obtaining the current call stack is much faster via a SecurityManger, but access to the underlying method may be restricted by the current SecurityManager. In environments where a SecurityManager cannot be created,ThrowableCallStackshould be used instead.- Since:
- 2.4.3
- See Also:
RuntimePermission,SecurityManager.getClassContext()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSecurityManagerCallStack.PrivateSecurityManagerA custom security manager.private static classSecurityManagerCallStack.SnapshotA snapshot of a class stack.
-
Field Summary
Fields Modifier and Type Field Description private java.text.DateFormatdateFormatprivate java.lang.StringmessageFormatprivate SecurityManagerCallStack.PrivateSecurityManagersecurityManagerprivate SecurityManagerCallStack.Snapshotsnapshot
-
Constructor Summary
Constructors Constructor Description SecurityManagerCallStack(java.lang.String messageFormat, boolean useTimestamp)Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the current stack trace snapshot.voidfillInStackTrace()Takes a snapshot of the current call stack.booleanprintStackTrace(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
-
securityManager
private final SecurityManagerCallStack.PrivateSecurityManager securityManager
-
snapshot
private volatile SecurityManagerCallStack.Snapshot snapshot
-
-
Method Detail
-
printStackTrace
public boolean printStackTrace(java.io.PrintWriter writer)
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().
-
-