You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Nick Bauman <ni...@cortexity.com> on 2001/06/12 17:27:16 UTC

Context question: is it threadsafe?

Forget about web/servlets for a moment. I'm using Velocity in a mail
templating system. (try _that_ with JSP!) I have a very basic question:

VelocityContext   context = new VelocityContext();

Is the VelocityContext object threadsafe? Or do I have to instantiate one
for each call to the template I want? 

Thanks for any insights.

-- 
Nick Bauman
Software Developer
3023 Lynn #22
Minneapolis, MN
55416
Mobile Phone: (612) 810-7406


Re: Context question: is it threadsafe?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Nick Bauman wrote:
> 
> Forget about web/servlets for a moment. I'm using Velocity in a mail
> templating system. (try _that_ with JSP!) I have a very basic question:
> 
> VelocityContext   context = new VelocityContext();
> 
> Is the VelocityContext object threadsafe? Or do I have to instantiate one
> for each call to the template I want?

It is not threadsafe.  You can reuse them, but a VelocityContext should
only be running down through one template at a time.  So if you have to,
pool them.

geir

> 
> Thanks for any insights.
> 
> --
> Nick Bauman
> Software Developer
> 3023 Lynn #22
> Minneapolis, MN
> 55416
> Mobile Phone: (612) 810-7406

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!