#59268 - cache typeloader because of OOMs in the jenkins tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1834236 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2018-06-24 07:30:20 +00:00
parent 2de46d1921
commit 63b1f6a133
1 changed files with 16 additions and 4 deletions

View File

@ -871,10 +871,22 @@ under the License.
</classpath> </classpath>
</xmlbean> </xmlbean>
<replaceregexp byline="true" <local name="loaderMethod"/>
match="(\s*)public static ([^ ]+) newInstance\(\) \{" <property name="loaderMethod"><![CDATA[
replace="\1private static org.apache.xmlbeans.SchemaTypeLoader getTypeLoader() { return org.apache.xmlbeans.XmlBeans.typeLoaderForClassLoader(\2.class.getClassLoader()); }${line.separator}${line.separator}\1public static \2 newInstance\(\) \{" private static java.lang.ref.SoftReference<org.apache.xmlbeans.SchemaTypeLoader> typeLoader;
>
private static synchronized org.apache.xmlbeans.SchemaTypeLoader getTypeLoader() {
org.apache.xmlbeans.SchemaTypeLoader stl = (typeLoader == null) ? null : typeLoader.get();
if (stl == null) {
stl = org.apache.xmlbeans.XmlBeans.typeLoaderForClassLoader(\2.class.getClassLoader());
typeLoader = new java.lang.ref.SoftReference(stl);
}
return stl;
}
public static \2 newInstance\(\) \{]]></property>
<replaceregexp byline="true" match="(\s*)public static ([^ ]+) newInstance\(\) \{" replace="${loaderMethod}">
<fileset dir="${xmlbean.sources.dir}" includes="**/*.java" excludes="**/impl/**"/> <fileset dir="${xmlbean.sources.dir}" includes="**/*.java" excludes="**/impl/**"/>
</replaceregexp> </replaceregexp>