File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
core/src/main/java/software/amazon/awssdk/core/util Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "category" : " AWS SDK for Java v2" ,
3
+ "type" : " feature" ,
4
+ "description" : " Caching `XPathFactory` to improve performance of exception handling for services using XML protocol"
5
+ }
Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ public final class XpathUtils {
65
65
66
66
private static final Logger log = LoggerFactory .getLogger (XpathUtils .class );
67
67
68
+ /**
69
+ * Shared factory for creating XML Factory
70
+ */
71
+ private static final ThreadLocal <XPathFactory > X_PATH_FACTORY = ThreadLocal .withInitial (XPathFactory ::newInstance );
72
+
68
73
private static final ErrorHandler ERROR_HANDLER = new ErrorHandler () {
69
74
70
75
@ Override
@@ -156,7 +161,7 @@ private static void speedUpDcoumentBuilderFactory() {
156
161
* reentrant.
157
162
*/
158
163
public static XPath xpath () {
159
- return XPathFactory . newInstance ().newXPath ();
164
+ return X_PATH_FACTORY . get ().newXPath ();
160
165
}
161
166
162
167
/**
You can’t perform that action at this time.
0 commit comments