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

public Class SecurityManagerCallStack

extends Object
implements CallStack
Class Inheritance
All Implemented Interfaces
org.apache.commons.pool2.impl.CallStack
Imports
java.io.PrintWriter, java.lang.ref.WeakReference, java.security.AccessController, .PrivilegedAction, java.text.DateFormat, .SimpleDateFormat, java.util.List, java.util.stream.Collectors, .Stream

A CallStack strategy using a SecurityManager. 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, ThrowableCallStack should be used instead.
Since
2.4.3
See Also
RuntimePermission, SecurityManager#getClassContext()

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
SecurityManagerCallStack.PrivateSecurityManager

References Deprecated SecurityManager is deprecated or references (maybe indirectly) at least one deprecated element.
A custom security manager.
private static class
SecurityManagerCallStack.Snapshot

A snapshot of a class stack.

Field Summary

Modifier and TypeField and Description
private final DateFormat
private final String
private final SecurityManagerCallStack.PrivateSecurityManager
securityManager

References Deprecated SecurityManagerCallStack.PrivateSecurityManager is deprecated or references (maybe indirectly) at least one deprecated element.
private volatile SecurityManagerCallStack.Snapshot

Constructor Summary

AccessConstructor and Description
public
SecurityManagerCallStack(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 boolean
printStackTrace(final PrintWriter 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
securityManagerback to summary
private final SecurityManagerCallStack.PrivateSecurityManager securityManager

References Deprecated

SecurityManagerCallStack.PrivateSecurityManager is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

snapshotback to summary
private volatile SecurityManagerCallStack.Snapshot snapshot

Constructor Detail

SecurityManagerCallStackback to summary
public SecurityManagerCallStack(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 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.

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

private final Class SecurityManagerCallStack.PrivateSecurityManager

extends SecurityManager
Class Inheritance

References Deprecated

SecurityManager is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

A custom security manager.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private List<WeakReference<Class<?>>>

Returns:

class stack
getCallStack
()

Gets the class stack.

Inherited from java.lang.SecurityManager:
checkAcceptcheckAccesscheckAccesscheckConnectcheckConnectcheckCreateClassLoadercheckDeletecheckExeccheckExitcheckLinkcheckListencheckMulticastcheckMulticastcheckPackageAccesscheckPackageDefinitioncheckPermissioncheckPermissioncheckPrintJobAccesscheckPropertiesAccesscheckPropertyAccesscheckReadcheckReadcheckReadcheckSecurityAccesscheckSetFactorycheckWritecheckWritegetClassContextgetSecurityContextgetThreadGroup

Constructor Detail

PrivateSecurityManagerback to summary
private PrivateSecurityManager()

Method Detail

getCallStackback to summary
private List<WeakReference<Class<?>>> getCallStack()

Gets the class stack.

Returns:List<WeakReference<Class<?>>>

class stack

org.apache.commons.pool2.impl back to summary

private final Class SecurityManagerCallStack.Snapshot

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.commons.pool2.impl.SecurityManagerCallStack.Snapshot

A snapshot of a class stack.

Field Summary

Modifier and TypeField and Description
private final List<WeakReference<Class<?>>>
private final long

Constructor Summary

AccessConstructor and Description
private
Snapshot(final List<WeakReference<Class<?>>>
class stack
stack
)

Constructs a new snapshot with a class stack.

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stackback to summary
private final List<WeakReference<Class<?>>> stack
timestampMillisback to summary
private final long timestampMillis

Constructor Detail

Snapshotback to summary
private Snapshot(final List<WeakReference<Class<?>>> stack)

Constructs a new snapshot with a class stack.

Parameters
stack:List<WeakReference<Class<?>>>

class stack