Author: jbalunas(a)redhat.com
Date: 2010-12-17 11:47:39 -0500 (Fri, 17 Dec 2010)
New Revision: 20660
Modified:
branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java
Log:
RFPL-967, RF-10035 Switched from ArrayStack to LinkedList
Modified:
branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java
===================================================================
---
branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java 2010-12-17
16:26:12 UTC (rev 20659)
+++
branches/enterprise/3.3.1.SP2_RFPL-967/framework/impl/src/main/java/org/ajax4jsf/util/DocumentBuilderPool.java 2010-12-17
16:47:39 UTC (rev 20660)
@@ -21,14 +21,13 @@
*/
package org.ajax4jsf.util;
-import java.util.EmptyStackException;
+import java.util.LinkedList;
+import java.util.NoSuchElementException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.collections.ArrayStack;
-
/**
* Manages a shared pool of DocumentBuilders so that there is not a performance
* hit for every request to create.
@@ -47,7 +46,7 @@
* Creates and holds the pool using the Initialization On Demand Holder idiom.
*/
private static class DocumentBuilderPoolHolder {
- static ArrayStack _documentBuilderPool = new ArrayStack(DOC_BUILDER_POOL_SIZE);
+ static LinkedList<DocumentBuilder> _documentBuilderPool = new
LinkedList<DocumentBuilder>();
}
/**
@@ -69,7 +68,7 @@
//pop the top builder - if empty it will through EmptyStackException
builder = (DocumentBuilder) DocumentBuilderPoolHolder._documentBuilderPool.pop();
}
- } catch (EmptyStackException e) {
+ } catch (NoSuchElementException e) {
//Stack is empty, create a new builder
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
}