private static void speedUpDTMManager ( ) throws Exception { // https://github.com/aws/aws-sdk-java/issues/238 // http://stackoverflow.com/questions/6340802/java-xpath-apache-jaxp-implementation-performance if ( System . getProperty ( DTM_MANAGER_DEFAULT_PROP_NAME ) == null ) { Class < ? > XPathContextClass = Class . forName ( XPATH_CONTEXT_CLASS_NAME ) ; Method getDTMManager = XPathContextClass . getMethod ( "getDTMManager" ) ; Object XPathContext = XPathContextClass . newInstance ( ) ; Object dtmManager = getDTMManager . invoke ( XPathContext ) ; if ( DTM_MANAGER_IMPL_CLASS_NAME . equals ( dtmManager . getClass ( ) . getName ( ) ) ) { // This would avoid the file system to be accessed every time // the internal XPathContext is instantiated. System . setProperty ( DTM_MANAGER_DEFAULT_PROP_NAME , DTM_MANAGER_IMPL_CLASS_NAME ) ; } } }
Used to optimize performance by avoiding expensive file access every time a DTMManager is constructed as a result of constructing a Xalan xpath context!