[ http://issues.apache.org/jira/browse/VELOCITY-434?page=comments#action_12370457 ]
Will Glass-Husain commented on VELOCITY-434: -------------------------------------------- Thanks for sharing this code. I've been thinking about this, and I believe the best place for CommonsParserPool is under ContributedCode in the Wiki. While I think this implementation is a great idea (special benefit to high volume webapps), for most users the default pool implementation is more than sufficient. I'm reluctant to endorse adding a new compile and run-time dependency for a small audience. If anyone wants to make a case for including this in the core- fire away. But otherwise, Serge, I encourage you to post this to the Wiki so others can take advantage of it. (I might use it myself, for example). If no one objects I'll then resolve this issue after the code is posted to the Wiki. > Commons pool implementation of the parser pool > ---------------------------------------------- > > Key: VELOCITY-434 > URL: http://issues.apache.org/jira/browse/VELOCITY-434 > Project: Velocity > Type: Improvement > Components: Source > 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. - 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]