This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.commons.threads-3.2.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-threads.git
commit 66cfaeab2c923fdc8643b3bd9706d9ae743c56f4 Author: Justin Edelson <[email protected]> AuthorDate: Fri Aug 17 20:26:07 2012 +0000 SLING-2563 - auto generate label based on a stack trace git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/threads@1374422 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/threads/impl/DefaultThreadPoolManager.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java b/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java index 3344313..ee86399 100644 --- a/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java +++ b/src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java @@ -161,6 +161,19 @@ public class DefaultThreadPoolManager if ( config == null ) { throw new IllegalArgumentException("Config must not be null."); } + + if ( label == null ) { + // generate the label by taking the first external frame off the stack trace + final StackTraceElement[] stackTrace = new Exception().getStackTrace(); + if ( stackTrace != null && stackTrace.length > 1 ) { + if ( stackTrace[1].getClassName().equals( this.getClass().getName() ) ) { + label = stackTrace[2].getClassName(); + } else { + label = stackTrace[1].getClassName(); + } + } + } + final String name = "ThreadPool-" + UUID.randomUUID().toString() + (label == null ? "" : " (" + label + ")"); final Entry entry = new Entry(null, config, name); -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
