com.liferay.faces.util.xml
Class ConcurrentSAXParserFactory

java.lang.Object
  extended by javax.xml.parsers.SAXParserFactory
      extended by com.liferay.faces.util.xml.ConcurrentSAXParserFactory

public class ConcurrentSAXParserFactory
extends SAXParserFactory

This class serves as an alternative to the SAXParserFactory that is provided by the JRE and provides the following benefits: 1) The static newSAXParser() method does not suffer from the performance problem of obtaining parser implementations from the classpath, and 2) Since newSAXParser() can be called without performance concerns, multi-threaded environments (like web applications and portlets) can feel free to call the method as much as required in each request, in order to maintain thread-safety. The drawback is that the SAXParserImpl class does fully implement all of the functionality of the one provided by the JRE.

For more information about the performance issues of the implementation provided by the JRE, see Reuse parser instances with the Xerces2 SAX and DOM implementations.

Author:
Neil Griffin

Constructor Summary
protected ConcurrentSAXParserFactory()
           
 
Method Summary
 boolean getFeature(String name)
           
static SAXParserFactory newInstance()
           
 SAXParser newSAXParser()
           
 void setFeature(String name, boolean value)
           
 
Methods inherited from class javax.xml.parsers.SAXParserFactory
getSchema, isNamespaceAware, isValidating, isXIncludeAware, newInstance, setNamespaceAware, setSchema, setValidating, setXIncludeAware
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentSAXParserFactory

protected ConcurrentSAXParserFactory()
Method Detail

newInstance

public static SAXParserFactory newInstance()

newSAXParser

public SAXParser newSAXParser()
                       throws ParserConfigurationException,
                              SAXException
Specified by:
newSAXParser in class SAXParserFactory
Throws:
ParserConfigurationException
SAXException

getFeature

public boolean getFeature(String name)
                   throws ParserConfigurationException,
                          SAXNotRecognizedException,
                          SAXNotSupportedException
Specified by:
getFeature in class SAXParserFactory
Throws:
ParserConfigurationException
SAXNotRecognizedException
SAXNotSupportedException

setFeature

public void setFeature(String name,
                       boolean value)
                throws ParserConfigurationException,
                       SAXNotRecognizedException,
                       SAXNotSupportedException
Specified by:
setFeature in class SAXParserFactory
Throws:
ParserConfigurationException
SAXNotRecognizedException
SAXNotSupportedException


Copyright © 2015 Liferay, Inc.. All rights reserved.