mirror of https://github.com/apache/poi.git
provide way to clear the state on the ThreadLocal used byby ExtractorFactory
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907581 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
28a26d9cb2
commit
326126a365
|
@ -102,11 +102,29 @@ public final class POIXMLExtractorFactory implements ExtractorProvider {
|
|||
/**
|
||||
* Should this thread prefer event based over usermodel based extractors?
|
||||
* Will only be used if the All Threads setting is null.
|
||||
*
|
||||
* <p>
|
||||
* This uses ThreadLocals and these can leak resources when you have a lot of threads.
|
||||
* </p>
|
||||
*
|
||||
* You should always try to call {@link #removeThreadPrefersEventExtractorsSetting()}.
|
||||
*
|
||||
* @see #setAllThreadsPreferEventExtractors
|
||||
*/
|
||||
public static void setThreadPrefersEventExtractors(boolean preferEventExtractors) {
|
||||
ExtractorFactory.setThreadPrefersEventExtractors(preferEventExtractors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the setting for this thread made by {@link #setThreadPrefersEventExtractors(boolean) }
|
||||
*
|
||||
* @see #setThreadPrefersEventExtractors(boolean)
|
||||
* @since POI 5.2.4
|
||||
*/
|
||||
public static void removeThreadPrefersEventExtractorsSetting() {
|
||||
ExtractorFactory.removeThreadPrefersEventExtractorsSetting();
|
||||
}
|
||||
|
||||
/**
|
||||
* Should all threads prefer event based over usermodel based extractors?
|
||||
* If set, will take preference over the Thread level setting.
|
||||
|
|
|
@ -111,12 +111,28 @@ public final class ExtractorFactory {
|
|||
* Should this thread prefer event based over usermodel based extractors?
|
||||
* Will only be used if the All Threads setting is null.
|
||||
*
|
||||
* <p>
|
||||
* This uses ThreadLocals and these can leak resources when you have a lot of threads.
|
||||
* </p>
|
||||
*
|
||||
* You should always try to call {@link #removeThreadPrefersEventExtractorsSetting()}.
|
||||
*
|
||||
* @param preferEventExtractors If this threads should prefer event based extractors.
|
||||
*/
|
||||
public static void setThreadPrefersEventExtractors(boolean preferEventExtractors) {
|
||||
threadPreferEventExtractors.set(preferEventExtractors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the setting for this thread made by {@link #setThreadPrefersEventExtractors(boolean) }
|
||||
*
|
||||
* @see #setThreadPrefersEventExtractors(boolean)
|
||||
* @since POI 5.2.4
|
||||
*/
|
||||
public static void removeThreadPrefersEventExtractorsSetting() {
|
||||
threadPreferEventExtractors.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Should all threads prefer event based over usermodel based extractors?
|
||||
* If set, will take preference over the Thread level setting.
|
||||
|
|
Loading…
Reference in New Issue