[ http://issues.apache.org/jira/browse/VELOCITY-434?page=comments#action_12447337 ] Serge Knystautas commented on VELOCITY-434: -------------------------------------------
Yup, all were marked properly (https://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12329779). Enjoy! > Commons pool implementation of the parser pool > ---------------------------------------------- > > Key: VELOCITY-434 > URL: http://issues.apache.org/jira/browse/VELOCITY-434 > Project: Velocity > Issue Type: Improvement > Components: Engine > Reporter: Serge Knystautas > Priority: Minor > Fix For: 1.5 > > 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. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]