|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.configuration.XMLConfiguration
org.osesb.objectpools.configuration.ObjectPoolConfiguration
public class ObjectPoolConfiguration
The framework uses the Apache Pool Package (org.apache.commons.pool) to:
<pool-configuration> configures the pool itself, the second section
configures the objects in the pool. While the pool configuration is mostly
the same across object pool implementations, the pooled object configuration(s)
are specific to the object being pooled. For example, 1) JMS connection
properties for pooled JMS clients, and 2) SAX parser properties for
pooled SAX parsers.
This Class is the configuration for the pool and is used by all pool factories.
The pool configuration includes properties defined in the Apache Pool API
documentation, which can be found at http://jakarta.apache.org/commons/pool/apidocs.
The framework uses mostly the same pool configuration properties for all object pool
implementations.
Object pool configurations must be stand-alone configuration files. Although
XML Configuration framework supports XPath expressions to content model root elements,
object pool configurations cannot be included in another configuration file
and then referenced using XPath.
The example, below, is a configuration for a pool of homogenous DOM parsers,
all with namespaceAware=true and validating=false. DOMPoolFactory uses a configuration
like this to construct the pool. This Class, ObjectPoolConfiguration, encapsulates
the <pool-configuration> content model, which contains properties for configuring
the pool, which in this example will be org.apache.commons.pool.impl.GenericObjectPool.
org.apache.commons.pool.impl.GenericObjectPool is the Apache pool class for homogenous
object pools.
<pooled-dom-parser>
<pool-configuration>
<!-- an optional name for the pool -->
<poolName>osESB Non-Keyed DOM Parser Pool</poolName>
<!-- display a pool heartbeat message every heartbeatInterval seconds -->
<heartbeatInterval>300</heartbeatInterval>
<!-- debugFlag -->
<debugFlag>true</debugFlag>
<!-- parameters that are specific to the pool implementation go here -->
<!-- these are the config properties for jakarta-commons-pooling -->
<!-- GenericObjectPool Config -->
<maxIdle></maxIdle>
<!-- No limit to the number of objects -->
<maxActive>-1</maxActive>
<maxWait>-1</maxWait>
<!-- Grow the pool when a borrowobject() fails -->
<whenExhaustedAction>2</whenExhaustedAction>
<testOnBorrow>false</testOnBorrow>
<testOnReturn>false</testOnReturn>
<testWhileIdle>false</testWhileIdle>
<!-- check for idle objects every 6 minutes (normally) -->
<timeBetweenEvictionRunsMillis>360000</timeBetweenEvictionRunsMillis>
<numTestsPerEvictionRun></numTestsPerEvictionRun>
<!-- evict objects idle more than 5 minutes (normally) -->
<minEvictableIdleTimeMillis>300000</minEvictableIdleTimeMillis>
<!-- display pool startup message -->
<displayStartupMessageFlag>true</displayStartupMessageFlag>
</pool-configuration>
<!-- the pooled SAX parsers configuration using JAXP -->
<jaxp-configuration>
<!-- use parser factory defaults - ignore parser property elements -->
<useDefaultParserConfigurationFlag>false</useDefaultParserConfigurationFlag>
<!-- do not use parser factory defaults - set these properties excplicitly -->
<!-- used when validating against schems -->
<!-- namespaceAware should always be true, validating or not -->
<namespaceAware>true</namespaceAware>
<validating>false</validating>
<!-- null for dtd -->
<schemaLanguage>http://www.w3.org/2001/XMLSchema</schemaLanguage>
</jaxp-configuration>
</pooled-dom-parser>
| Field Summary |
|---|
| Fields inherited from class org.osesb.configuration.XMLConfiguration |
|---|
configFilePath, configurationProperties, constructedFromConfigFile, contentModelElement, ftpClientConfiguration, jaxrpcClientConfiguration, jdbcConfiguration, jmsClientConfiguration, log, rootConfigurationAttributes, smtpClientConfiguration, systemProperties, thisClassName |
| Constructor Summary | |
|---|---|
ObjectPoolConfiguration(org.w3c.dom.Element contentModelElement)
Creates a new instance of ObjectPoolConfiguration given the content model Element. |
|
ObjectPoolConfiguration(java.lang.String configFile)
Creates a new instance of ObjectPoolConfiguration given a XML configuration file. |
|
ObjectPoolConfiguration(java.lang.String configFile,
java.lang.String xpathExpression)
Creates a new instance of ObjectPoolConfiguration given a XML configuration file and a XPath expression that evaluates to the element that marks the beginning of the configuration. |
|
| Method Summary | |
|---|---|
boolean |
getDisplayStartupMessageFlag()
Returns the displayStartupMessageFlag for the pool configuration. |
long |
getHeartbeatInterval()
Returns optional the heartbeatInterval, which defines the number of seconds between "health" messages that a pool may write or send to a log provider, like log4j. |
java.lang.String |
getName()
Returns the optional name for this pool. |
java.lang.String |
getPooledClassName()
Returns the className of the pooled object from the configuration. |
static void |
main(java.lang.String[] args)
Main method for testing. |
void |
setPooledClassName(java.lang.String pooledClassName)
Sets the className of the pooled object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ObjectPoolConfiguration(java.lang.String configFile)
throws java.lang.Exception
configFile - The path to the XML configuration file, which
is specified as a resource path or as a file system
path that is relative to the path specified
by the ConfigurationConstants.CONFIG_PATH_SYSTEMPROPERTY
System Property.
java.lang.Exception - if there is a problem reading or parsing the
configuration file.
public ObjectPoolConfiguration(java.lang.String configFile,
java.lang.String xpathExpression)
throws java.lang.Exception
configFile - The path to the XML configuration file, which
is specified as a resource path or as a file system
path that is relative to the path specified
by the ConfigurationConstants.CONFIG_PATH_SYSTEMPROPERTY
System Property.xpathExpression - A XPath expression that evaluates to the
element that marks the beginning of the
configuration. If following the framework
convention for ObjectPoolConfiguration(s),
xpathExpression should have 'pool-configuration'
as the last Element in the path.
java.lang.Exception - if there is a problem reading or parsing the
configuration file.
public ObjectPoolConfiguration(org.w3c.dom.Element contentModelElement)
throws java.lang.Exception
contentModelElement - The top level Element for the
for the configuration.
java.lang.Exception - if there is a fatal error transversing the
configuration content model enclosed by contentModelElement.| Method Detail |
|---|
public java.lang.String getPooledClassName()
public void setPooledClassName(java.lang.String pooledClassName)
pooledClassName - The className of the pooled object.public java.lang.String getName()
getName in class XMLConfigurationpublic long getHeartbeatInterval()
public boolean getDisplayStartupMessageFlag()
public static void main(java.lang.String[] args)
args -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||