You mean something like XMLInputFactory.newFactory("javax.xml.stream.XMLInputFactory", XmlParserHelper.class.getClassLoader())
Yes, but we should use newInstance(), as newFactory() was introduced with JDK 1.6.18 only.
I like the idea, but it needs more testing than just making the instance non static.
True.
how much benefit do we get by "caching" the XMLInputFactory.
Yes, that's the question. The method seems to make use of the service loader, so its calls are surely not for free, but as this would only affect the usage during bootstrapping it might be acceptable.
|