This is an automated email from the ASF dual-hosted git repository.
rgoers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/master by this push:
new 3482450 LOG4J2-3006 - Directly create a thread instead of using the
common ForkJoin pool when initializing ThreadContextDataInjector
3482450 is described below
commit 3482450de877a9e0c1093c45728249a86ff1c7bb
Author: Ralph Goers <[email protected]>
AuthorDate: Sun Feb 7 11:21:57 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 8b369fe..2923758 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
@@ -137,7 +137,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();
}
/**
@@ -166,7 +168,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();
}
public void addShutdownListener(LoggerContextShutdownAware listener) {
@@ -768,4 +772,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 9ca3f47..c2143aa 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -227,6 +227,9 @@
</action>
</release>
<release version="2.14.1" date="2020-MM-DD" description="GA Release
2.14.1">
+ <action issue="LOG4J2-3006" dev="rgoers" type="fix">
+ Directly create a thread instead of using the common ForkJoin pool
when initializing ThreadContextDataInjector"
+ </action>
<action dev="rgoers" type="update">
Update Spring dependencies to 5.3.2, Spring Boot to 2.3.6, and Spring
Cloud to Hoxton.SR9.
</action>