Skip to content
Permalink
Browse files
removed double checking lock
  • Loading branch information
lviggiano committed Sep 2, 2019
1 parent 11ca019 commit 0b2d209b0fe661a1596aa55921fff16e2ba5bc92
Showing 1 changed file with 4 additions and 8 deletions.
@@ -38,15 +38,11 @@ public class XMLLoader implements Loader {
private static final long serialVersionUID = -894351666332018767L;
private transient SAXParserFactory factory = null;

private SAXParserFactory factory() {
private synchronized SAXParserFactory factory() {
if (factory == null) {
synchronized (this) {
if (factory == null) {
factory = SAXParserFactory.newInstance();
factory.setValidating(true);
factory.setNamespaceAware(true);
}
}
factory = SAXParserFactory.newInstance();
factory.setValidating(true);
factory.setNamespaceAware(true);
}
return factory;
}

0 comments on commit 0b2d209

Please sign in to comment.