Here you can find the source of newDocumentBuilderFactory()
public static DocumentBuilderFactory newDocumentBuilderFactory()
//package com.java2s; //License from project: Open Source License import javax.xml.parsers.*; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class Main { private static final Lock factoryLock = new ReentrantLock(); public static DocumentBuilderFactory newDocumentBuilderFactory() { factoryLock.lock();/*w w w. ja v a 2 s .c o m*/ try { return DocumentBuilderFactory.newInstance(); } finally { factoryLock.unlock(); } } }