This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Is Velocity thread safe? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Is Velocity thread safe?" Watch "Is Velocity thread safe?" New topic
Author

Is Velocity thread safe?

Jayesh A Lalwani
Saloon Keeper

Joined: Jan 17, 2008
Posts: 2667
    
  31

We have a Velocity Helper class that wraps Velocity engine for processing templates. The helper method is basically this



The thing is VelocityEngine is not really a lightweightt object, and I wanted to see if we can avoid creating an engine eveytime. In my thread dumps I see it loading and parsing some resources from classpath. This creates memory issues in JBoss 5.1 because VelocityEngine ends up calling CFS which has memory leaks. That is a whole another issue of course, but frequent creation of VelocityEngine instances excaberates the JBoss memory leaks. We are going to explode our war so we don;t use VFS.

So, I was wondering if I can just have one instance of VelocityEngine? Is it thread safe?
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Is Velocity thread safe?
 
jQuery in Action, 3rd edition