This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/release-2.x by this push:
new e3edf46 Javadoc.
new c65bcfc Merge branch 'release-2.x' of
https://gitbox.apache.org/repos/asf/logging-log4j2 into release-2.x
e3edf46 is described below
commit e3edf467c34499d9933b8cb14b74af34e7cb8f72
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Jan 17 15:56:30 2022 -0500
Javadoc.
---
.../log4j/util/PrivateSecurityManagerStackTraceUtil.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git
a/log4j-api/src/main/java/org/apache/logging/log4j/util/PrivateSecurityManagerStackTraceUtil.java
b/log4j-api/src/main/java/org/apache/logging/log4j/util/PrivateSecurityManagerStackTraceUtil.java
index d8852aa..2f2be07 100644
---
a/log4j-api/src/main/java/org/apache/logging/log4j/util/PrivateSecurityManagerStackTraceUtil.java
+++
b/log4j-api/src/main/java/org/apache/logging/log4j/util/PrivateSecurityManagerStackTraceUtil.java
@@ -20,7 +20,7 @@ import java.util.ArrayDeque;
import java.util.Deque;
/**
- * Internal utility to share a fast implementation of {@link
#getCurrentStackTrace()}
+ * Internal utility to share a fast implementation of {@code
#getCurrentStackTrace()}
* with the java 9 implementation of {@link StackLocator}.
*/
final class PrivateSecurityManagerStackTraceUtil {
@@ -50,6 +50,16 @@ final class PrivateSecurityManagerStackTraceUtil {
return SECURITY_MANAGER != null;
}
+ /**
+ * Returns the current execution stack as a Deque of classes.
+ * <p>
+ * The size of the Deque is the number of methods on the execution stack.
The first element is the class that started
+ * execution on this thread, the next element is the class that was called
next, and so on, until the last element: the
+ * method that called {@link SecurityManager#getClassContext()} to capture
the stack.
+ * </p>
+ *
+ * @return the execution stack.
+ */
// benchmarks show that using the SecurityManager is much faster than
looping through getCallerClass(int)
static Deque<Class<?>> getCurrentStackTrace() {
final Class<?>[] array = SECURITY_MANAGER.getClassContext();