Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
V2 2.0.6
Description
Dear Olingo developers,
New instances of XMLInputFactory, Transformer and XMLStreamWriter are created on each request that parses/produces XML documents.
These instances are obtained through the ServiceLoader class, which is known for being slow.
See:
These objects could be instanciated only once and stored as static class fields.
odata-core/src/main/java/org/apache/olingo/odata2/core/commons/XmlHelper.java 41: XMLInputFactory factory = XMLInputFactory.newInstance(); odata-core/src/main/java/org/apache/olingo/odata2/core/debug/DebugInfoBody.java 120: Transformer transformer = TransformerFactory.newInstance().newTransformer(); odata-core/src/main/java/org/apache/olingo/odata2/core/edm/provider/EdmServiceMetadataImplProv.java 75: XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer); odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java 110: XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream, DEFAULT_CHARSET); 165: XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream, DEFAULT_CHARSET); 201: XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream, DEFAULT_CHARSET); 228: XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream, DEFAULT_CHARSET); 257: XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream, DEFAULT_CHARSET); 286: XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream, DEFAULT_CHARSET); 313: XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream, DEFAULT_CHARSET); odata-core/src/main/java/org/apache/olingo/odata2/core/ep/BasicEntityProvider.java 245: XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer); odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/AtomServiceDocumentProducer.java 60: XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer);
Thanks,
John.