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

rgoers 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 82d689c  LOG4J2-3006 - Directly create a thread instead of using the 
common ForkJoin pool when initializing ThreadContextDataInjector
82d689c is described below

commit 82d689c920f8cee617da351c18a0c552dd182e87
Author: Ralph Goers <[email protected]>
AuthorDate: Sun Feb 7 09:43:16 2021 -0700

    LOG4J2-3006 - Directly create a thread instead of using the common ForkJoin 
pool when initializing ThreadContextDataInjector
---
 .../org/apache/logging/log4j/core/LoggerContext.java    | 17 +++++++++++++++--
 src/changes/changes.xml                                 |  3 +++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
index b5cc60d..eda1b9e 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
@@ -138,7 +138,9 @@ public class LoggerContext extends AbstractLifeCycle
             externalMap.put(EXTERNAL_CONTEXT_KEY, externalContext);
         }
         this.configLocation = configLocn;
-        
CompletableFuture.runAsync(ThreadContextDataInjector::initServiceProviders);
+        Thread runner = new Thread(new ThreadContextDataTask(), "Thread 
Context Data Task");
+        runner.setDaemon(true);
+        runner.start();
     }
 
     /**
@@ -167,7 +169,9 @@ public class LoggerContext extends AbstractLifeCycle
         } else {
             configLocation = null;
         }
-        
CompletableFuture.runAsync(ThreadContextDataInjector::initServiceProviders);
+        Thread runner = new Thread(new ThreadContextDataTask(), "Thread 
Context Data Task");
+        runner.setDaemon(true);
+        runner.start();
     }
 
     @Override
@@ -775,4 +779,13 @@ public class LoggerContext extends AbstractLifeCycle
         return new Logger(ctx, name, messageFactory);
     }
 
+    private class ThreadContextDataTask implements Runnable {
+
+        @Override
+        public void run() {
+            LOGGER.debug("Initializing Thread Context Data Service Providers");
+            ThreadContextDataInjector.initServiceProviders();
+            LOGGER.debug("Thread Context Data Service Provider initialization 
complete");
+        }
+    }
 }
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e7520a2..35183f7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -31,6 +31,9 @@
     -->
     <release version="2.14.1" date="2021-MM-DD" description="GA Release 
2.14.1">
       <!-- FIXES -->
+      <action issue="LOG4J2-3006" dev="rgoers" type="fix">
+        Directly create a thread instead of using the common ForkJoin pool 
when initializing ThreadContextDataInjector"
+      </action>
       <action issue="LOG4J2-2624" dev="mattsicker" type="fix" due-to="Tim 
Perry">
         Allow auto-shutdown of log4j in log4j-web to be turned off and provide 
a 
         ServletContextListener "Log4jShutdownOnContextDestroyedListener" to 
stop log4j.

Reply via email to