1 Star 0 Fork 82

佛系少年中二/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
0043-Cache-dom-in-xml-transform.patch 2.17 KB
一键复制 编辑 原始数据 按行查看 历史
Date: Fri, 9 Jun 2023 10:18:10 +0800
Subject: Cache dom in xml transform
---
.../xalan/internal/xsltc/trax/TransformerImpl.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java
index 8e783cee0..3d143d461 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java
@@ -56,6 +56,7 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.Properties;
import java.util.StringTokenizer;
import javax.xml.XMLConstants;
@@ -151,6 +152,11 @@ public final class TransformerImpl extends Transformer
*/
private DOM _dom = null;
+ /**
+ * A hashMap for DOMS.
+ */
+ private ConcurrentHashMap<String, DOM> _domMaps = new ConcurrentHashMap();
+
/**
* Number of indent spaces to add when indentation is on.
*/
@@ -530,8 +536,11 @@ public final class TransformerImpl extends Transformer
private DOM getDOM(Source source) throws TransformerException {
try {
DOM dom;
-
if (source != null) {
+ String ssId = source.getSystemId();
+ if ((ssId != null) && (_domMaps.containsKey(ssId))) {
+ return _domMaps.get(ssId);
+ }
DTMWSFilter wsfilter;
if (_translet != null && _translet instanceof StripFilter) {
wsfilter = new DOMWSFilter(_translet);
@@ -549,6 +558,7 @@ public final class TransformerImpl extends Transformer
}
dom = (DOM)_dtmManager.getDTM(source, false, wsfilter, true,
false, false, 0, hasIdCall);
+ if ((ssId != null) && (dom != null)) _domMaps.put(ssId, dom);
} else if (_dom != null) {
dom = _dom;
_dom = null; // use only once, so reset to 'null'
--
2.22.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Autistic_boyya/openjdk-1.8.0.git
git@gitee.com:Autistic_boyya/openjdk-1.8.0.git
Autistic_boyya
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助