org.ow2.petals.component.framework.util
Class JVMDocumentBuilderResourcePool

java.lang.Object
  extended by org.ow2.petals.component.framework.util.JVMDocumentBuilderResourcePool

public class JVMDocumentBuilderResourcePool
extends java.lang.Object

This class represent a JVM DocumentBuilder pool, which provided JVM DocumentBuilder object as resource.

Author:
noddoux

Constructor Summary
JVMDocumentBuilderResourcePool(int minPoolSize, int maxPoolSize, com.ebmwebsourcing.easycommons.pooling.PoolPolicy poolPolicy)
          Allowing to instantiate a new JVMDocumentBuilderResourcePool containing JVM DocumentBuilder resources.
 
Method Summary
 void release(javax.xml.parsers.DocumentBuilder jvmDocumentBuilder)
          Release the specified JVM DocumentBuilder After putting back the JVM DocumentBuilder in the pool, the method onRelease() of the JVM DocumentBuilder resource handler is called.
 javax.xml.parsers.DocumentBuilder take()
          Take one unused JVM DocumentBuilder in the current pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JVMDocumentBuilderResourcePool

public JVMDocumentBuilderResourcePool(int minPoolSize,
                                      int maxPoolSize,
                                      com.ebmwebsourcing.easycommons.pooling.PoolPolicy poolPolicy)
Allowing to instantiate a new JVMDocumentBuilderResourcePool containing JVM DocumentBuilder resources.

Parameters:
minPoolSize - The minimum number of JVM DocumentBuilder instances in the pool (created at the initialization).
maxPoolSize - the maximum number of JVM DocumentBuilder instances in the current pool (limit of the pool). It must be greater or equals to the specified minSize. The maximum value is Integer.MAX_VALUE
poolPolicy - the PoolPolicy to adopt when the maximum size is reached. it must not be null.
Method Detail

take

public javax.xml.parsers.DocumentBuilder take()
Take one unused JVM DocumentBuilder in the current pool. After getting a JVM DocumentBuilder from the pool and before returning a JVM DocumentBuilder, the method onTake() of the JVM DocumentBuilder resource handler is called.

Returns:
one JVM DocumentBuilder
Throws:
com.ebmwebsourcing.easycommons.pooling.PoolException - if the current thread is interrupted for the pool policy WAIT or if there is no more available resource in the pool for the pool policy REJECT

release

public final void release(javax.xml.parsers.DocumentBuilder jvmDocumentBuilder)
Release the specified JVM DocumentBuilder After putting back the JVM DocumentBuilder in the pool, the method onRelease() of the JVM DocumentBuilder resource handler is called.

Parameters:
jvmDocumentBuilder - The JVM DocumentBuilder to release


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.