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");
* you may not use this file except in compliance with the License.
@ -65,6 +65,11 @@ class FactoryFinder {
*/
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>
*
@ -277,9 +282,9 @@ class FactoryFinder {
BufferedReader rd;
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) {
rd = new BufferedReader(new InputStreamReader(is));
rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
}
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");
* you may not use this file except in compliance with the License.
@ -47,6 +47,11 @@ class FactoryFinder {
static SecuritySupport ss = new SecuritySupport() ;
static boolean firstTime = true;
/**
* Default columns per line.
*/
private static final int DEFAULT_LINE_LENGTH = 80;
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
@ -260,9 +265,9 @@ class FactoryFinder {
// jkesselm]
BufferedReader rd;
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) {
rd = new BufferedReader(new InputStreamReader(is));
rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
}
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");
* you may not use this file except in compliance with the License.
@ -47,6 +47,11 @@ class FactoryFinder {
static SecuritySupport ss = new SecuritySupport() ;
static boolean firstTime = true;
/**
* Default columns per line.
*/
private static final int DEFAULT_LINE_LENGTH = 80;
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
@ -260,9 +265,9 @@ class FactoryFinder {
// jkesselm]
BufferedReader rd;
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) {
rd = new BufferedReader(new InputStreamReader(is));
rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
}
String factoryClassName = null;