code: private synchronized static XPathFactory createXPathFactory() {
          XPathFactory factory = null;
  
          // read system property and see if there is a factory set
          Properties properties = System.getProperties();
          for (Map.Entry<Object, Object> prop : properties.entrySet()) {
              String key = (String) prop.getKey();
              if (key.startsWith(XPathFactory.DEFAULT_PROPERTY_NAME)) {
                  String uri = key.indexOf(":") > 0 ? key.substring(key.indexOf(":") + 1) : null;
                  if (uri != null) {
                      try {
                          factory = XPathFactory.newInstance(uri);
                      } catch (XPathFactoryConfigurationException e) {
                          log.warn("Failed to instantiate xpath factory", e);
                          factory = XPathFactory.newInstance();
                      }
                      log.info("Created xpath factory {} using system property {} with value {}", factory, key, uri);
                  }
              }
          }
  
          if (factory == null) {
              factory = XPathFactory.newInstance();
              log.info("Created default xpath factory {}", factory);
          }
  
          return factory;
      }
docs: Creates new xpath factory which is not thread safe per definition.
  @return