[
https://issues.apache.org/jira/browse/VELOCITY-434?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Henning Schmiedehausen closed VELOCITY-434.
-------------------------------------------
> Commons pool implementation of the parser pool
> ----------------------------------------------
>
> Key: VELOCITY-434
> URL: https://issues.apache.org/jira/browse/VELOCITY-434
> Project: Velocity
> Issue Type: Improvement
> Components: Engine
> Reporter: Serge Knystautas
> Priority: Minor
> Attachments: CommonsParserPool.java, CommonsParserPool.java,
> CommonsParserPoolFactory.java
>
>
> Now that with [Velocity-433] we can swap out the parser pool, here is a
> parser pool that uses commons-pool (http://jakarta.apache.org/commons/pool/).
> It is very primitive configuration and uses the same configuration name
> (parser.pool.size) for maximum number of elements in the pool. It is also
> configured to grow when the maximum number is exhausted, which means that it
> scales the same way as the original parser, while actually providing some
> better pool support.
> One of the nicest parts about this is that you can set your maximum instances
> to 0 and still get great performance. The first time you need a parser, it
> will still add one even though the max is reached (since grow when exhausted
> is set). Assuming the second time you need a parser is within a few seconds,
> that first instance is still there.
> Here is some sample code of how to use it your app.
> Properties configuration = new Properties();
> configuration.put("parser.pool.class",
> "com.lokitech.util.pool.CommonsParserPool");
> configuration.put("parser.pool.size", "0");
> Velocity.init(configuration);
> Since Velocity does not have an existing dependency on commons pool, I'm not
> sure this code will get packaged into the main distribution. This code is
> licensed using ASL 2.0, so please reuse however you want as long as
> attribution is kept per the license.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]