Merge in Performance Fix from the tck-jaxp-1_2_0 branch:

When reading the service provider name from a jar
a BufferedReader is used to read the first line from the
file. BufferedReader's default buffer size is 8K chars. Since
we're only reading one line (the name of a class) this is pretty
excessive. Reducing this size significantly to 80 chars.


git-svn-id: https://svn.apache.org/repos/asf/xml/commons/trunk@226237 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
mrglavas 2005-06-17 19:26:53 +00:00
parent a11ee29779
commit 729661318d
3 changed files with 24 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004 The Apache Software Foundation. * Copyright 2003-2005 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -64,6 +64,11 @@ class FactoryFinder {
*<p> Take care of restrictions imposed by java security model </p> *<p> Take care of restrictions imposed by java security model </p>
*/ */
private static SecuritySupport ss = new SecuritySupport(); private static SecuritySupport ss = new SecuritySupport();
/**
* Default columns per line.
*/
private static final int DEFAULT_LINE_LENGTH = 80;
/** /**
* <p>Check to see if debugging enabled by property.</p> * <p>Check to see if debugging enabled by property.</p>
@ -277,9 +282,9 @@ class FactoryFinder {
BufferedReader rd; BufferedReader rd;
try { try {
rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
} catch (java.io.UnsupportedEncodingException e) { } catch (java.io.UnsupportedEncodingException e) {
rd = new BufferedReader(new InputStreamReader(is)); rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
} }
String factoryClassName = null; String factoryClassName = null;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004 The Apache Software Foundation. * Copyright 2003-2005 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -46,6 +46,11 @@ class FactoryFinder {
static Properties cacheProps= new Properties(); static Properties cacheProps= new Properties();
static SecuritySupport ss = new SecuritySupport() ; static SecuritySupport ss = new SecuritySupport() ;
static boolean firstTime = true; static boolean firstTime = true;
/**
* Default columns per line.
*/
private static final int DEFAULT_LINE_LENGTH = 80;
// Define system property "jaxp.debug" to get output // Define system property "jaxp.debug" to get output
static { static {
@ -260,9 +265,9 @@ class FactoryFinder {
// jkesselm] // jkesselm]
BufferedReader rd; BufferedReader rd;
try { try {
rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
} catch (java.io.UnsupportedEncodingException e) { } catch (java.io.UnsupportedEncodingException e) {
rd = new BufferedReader(new InputStreamReader(is)); rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
} }
String factoryClassName = null; String factoryClassName = null;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004 The Apache Software Foundation. * Copyright 2003-2005 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -46,6 +46,11 @@ class FactoryFinder {
static Properties cacheProps= new Properties(); static Properties cacheProps= new Properties();
static SecuritySupport ss = new SecuritySupport() ; static SecuritySupport ss = new SecuritySupport() ;
static boolean firstTime = true; static boolean firstTime = true;
/**
* Default columns per line.
*/
private static final int DEFAULT_LINE_LENGTH = 80;
// Define system property "jaxp.debug" to get output // Define system property "jaxp.debug" to get output
static { static {
@ -260,9 +265,9 @@ class FactoryFinder {
// jkesselm] // jkesselm]
BufferedReader rd; BufferedReader rd;
try { try {
rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
} catch (java.io.UnsupportedEncodingException e) { } catch (java.io.UnsupportedEncodingException e) {
rd = new BufferedReader(new InputStreamReader(is)); rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
} }
String factoryClassName = null; String factoryClassName = null;