• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Is Velocity thread safe?

 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic