"One of them is that XPathFactory.newInstance () is very expensive:"
True statement! I noticed that for each thread calling newInstance (), jaxp.properties should be located in the classpath and read:
java.lang.Thread.State: BLOCKED (on object monitor) at java.util.zip.ZipFile.getEntry(ZipFile.java:160) - locked <0x0000000968dec028> (a sun.net.www.protocol.jar.URLJarFile) at java.util.jar.JarFile.getEntry(JarFile.java:208) at sun.net.www.protocol.jar.URLJarFile.getEntry(URLJarFile.java:107) at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:114) at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:132) at java.net.URL.openStream(URL.java:1010) at javax.xml.xpath.SecuritySupport$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at javax.xml.xpath.SecuritySupport.getURLInputStream(Unknown Source) at javax.xml.xpath.XPathFactoryFinder._newFactory(Unknown Source) at javax.xml.xpath.XPathFactoryFinder.newFactory(Unknown Source) at javax.xml.xpath.XPathFactory.newInstance(Unknown Source) at javax.xml.xpath.XPathFactory.newInstance(Unknown Source)
ZipFile creates its own call (for zlib, I believe), and unpacks the jar, which requires disk I / O and conversion to a zip converter. In this case, we had 1400+ threads waiting for this lock.
bmadigan
source share