增加与元空间中的TransformerFactory的XSLT转换(Increase in Meta

2019-10-29 06:46发布

当我运行多个不同的请求下面的代码,Java的元空间是越来越增加。

        public String applyXsltOnXml(String xmlString, String xsltInput) throws TransformerException {
         String result = null;
         try (StringReader stringReader = new StringReader(xmlString);
                 StringWriter writer = new StringWriter()) {
             TransformerFactory factory = TransformerFactory.newInstance();
             Transformer transformer = factory.newTransformer(new StreamSource(new StringReader(xsltInput)));
             transformer.transform(new StreamSource(stringReader), new StreamResult(writer));
             result = writer.toString();
         } 
         return result;
     }

能否请您解释一下什么是幕后发生的事情? 为什么java的元空间是越来越增加了吗?

文章来源: Increase in Metaspace with TransformerFactory's XSLT Transformer