diff options
author | Dominik Stadler <centic@apache.org> | 2023-03-11 06:49:12 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-03-11 06:49:12 +0000 |
commit | b8cc997cd03ce29b01f066b808d295c22807efe1 (patch) | |
tree | ceb089726171be8484981b2bceb72835d1daba5e /poi-scratchpad | |
parent | f192c95e0f0e073ee8596f946d7a44d204bef3f4 (diff) | |
download | poi-b8cc997cd03ce29b01f066b808d295c22807efe1.tar.gz poi-b8cc997cd03ce29b01f066b808d295c22807efe1.zip |
Bug 66521: Add a utility to clear all thread locals
Otherwise some applications may complain about left-over things,
e.g. Tomcat sometimes reports warning logs if Threads are not
cleaned up before being passed back into the global thread-pool.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1908263 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad')
-rw-r--r-- | poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java index 54438d7bb7..1447eab4b1 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java @@ -66,6 +66,7 @@ import org.apache.poi.sl.usermodel.SlideShow; import org.apache.poi.util.GenericRecordUtil; import org.apache.poi.util.IOUtils; import org.apache.poi.util.Internal; +import org.apache.poi.util.ThreadLocalUtil; import org.apache.poi.util.Units; /** @@ -92,6 +93,10 @@ public final class HSLFSlideShow extends POIDocument implements SlideShow<HSLFSh INIT, LOADED } private static final ThreadLocal<LoadSavePhase> loadSavePhase = new ThreadLocal<>(); + static { + // allow to clear all thread-locals via ThreadLocalUtil + ThreadLocalUtil.registerCleaner(loadSavePhase::remove); + } // What we're based on private final HSLFSlideShowImpl _hslfSlideShow; |