Skip to content

Commit

Permalink
removed double checking lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigi R. Viggiano committed Sep 2, 2019
1 parent 11ca019 commit 0b2d209
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions owner/src/main/java/org/aeonbits/owner/loaders/XMLLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0b2d209

Please sign in to comment.