This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 4a13449056 ARTEMIS-4499 fix ThreadCreateAction so it works properly 
with SecurityManager
4a13449056 is described below

commit 4a13449056f1b16707c8fd234e9e89053b39db09
Author: Emmanuel Hugonnet <[email protected]>
AuthorDate: Mon Nov 13 13:54:18 2023 +0100

    ARTEMIS-4499 fix ThreadCreateAction so it works properly with 
SecurityManager
    
    Issue: https://issues.apache.org/jira/browse/ARTEMIS-4499
    
    Signed-off-by: Emmanuel Hugonnet <[email protected]>
---
 .../org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java
 
b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java
index b8f8e80941..b9c3c28342 100644
--- 
a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java
+++ 
b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java
@@ -123,7 +123,14 @@ public final class ActiveMQThreadFactory implements 
ThreadFactory {
       };
       t.setDaemon(daemon);
       t.setPriority(threadPriority);
-      t.setContextClassLoader(tccl);
+      if (acc != null) {
+         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+            t.setContextClassLoader(tccl);
+            return null; // nothing to return
+         });
+      } else {
+         t.setContextClassLoader(tccl);
+      }
       return t;
    }
 

Reply via email to