com.ebmwebsourcing.easycommons.xml
Class DocumentBuilders

java.lang.Object
  extended by com.ebmwebsourcing.easycommons.xml.DocumentBuilders

public final class DocumentBuilders
extends java.lang.Object

A static pool of DocumentBuilder to improve DocumentBuilder creation efficiency. A DocumentBuilder is initialized the first time this class is used. An infinite number (integer maximum value) of DocumentBuilder may be created. They are never evicted.

Author:
Nicolas Oddoux - EBM WebSourcing

Constructor Summary
DocumentBuilders()
           
 
Method Summary
static org.w3c.dom.Document newDocument()
          Create a new Document (with a DocumentBuilder of the pool)
static void releaseDocumentBuilder(javax.xml.parsers.DocumentBuilder documentBuilder)
          Release a DocumentBuilder to the pool
static javax.xml.parsers.DocumentBuilder takeDocumentBuilder()
          Take a DocumentBuilder from the pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentBuilders

public DocumentBuilders()
Method Detail

takeDocumentBuilder

public static final javax.xml.parsers.DocumentBuilder takeDocumentBuilder()
                                                                   throws PoolException
Take a DocumentBuilder from the pool

Returns:
one DocumentBuilder
Throws:
PoolException - if the current thread waits for a DocumentBuilder of the pool and is interrupted

releaseDocumentBuilder

public static final void releaseDocumentBuilder(javax.xml.parsers.DocumentBuilder documentBuilder)
Release a DocumentBuilder to the pool

Parameters:
documentBuilder - a DocumentBuilder to release

newDocument

public static final org.w3c.dom.Document newDocument()
Create a new Document (with a DocumentBuilder of the pool)

Returns:
a new Document
Throws:
PoolException - if the current thread waits for a DocumentBuilder of the pool and is interrupted when the PoolPolicy is WAIT or if there is no more available DocumentBuilder in the DocumentBuilder pool when the PoolPolicy is REJECT


Copyright © 2012 Petals Link. All Rights Reserved.