You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Amir Zucker <am...@liveperson.com> on 2004/05/11 11:11:39 UTC

is velocity thread safe?

Hi all,

I plan to start using Velocity and am concerned about it not being
thread safe.  I had tried to look in the docs and found nothing on the
subject, so I guess (hope) this is the place to find the answer.

To the point : if I use a single VelocityEngine in a multi-threaded
environment, do I need to synchronize and make sure template generation
and or usage is not done in parallel?  More specifically, if two
templates are requested and created "at the same time" can this cause
problems?  If the same template is used concurrently, can this cause
problems?

Thanks,

Amir

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re: is velocity thread safe?

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On May 11, 2004, at 5:11 AM, Amir Zucker wrote:

> Hi all,
>
> I plan to start using Velocity and am concerned about it not being
> thread safe.  I had tried to look in the docs and found nothing on the
> subject, so I guess (hope) this is the place to find the answer.
>
> To the point : if I use a single VelocityEngine in a multi-threaded
> environment, do I need to synchronize and make sure template generation
> and or usage is not done in parallel?  More specifically, if two
> templates are requested and created "at the same time" can this cause
> problems?  If the same template is used concurrently, can this cause
> problems?

It's threadsafe.  The only place to watch out is when using a 
VelocityContext.  it is *not* thread safe - just use one per rendering 
request.

I'll be happy to elaborate if you care.

geir

-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re: is velocity thread safe?

Posted by Konstantin Priblouda <kp...@yahoo.com>.
--- Amir Zucker <am...@liveperson.com> wrote:
> Hi all,
> 
> I plan to start using Velocity and am concerned
> about it not being
> thread safe.  I had tried to look in the docs and
> found nothing on the
> subject, so I guess (hope) this is the place to find
> the answer.
> 
> To the point : if I use a single VelocityEngine in a
> multi-threaded
> environment, do I need to synchronize and make sure
> template generation
> and or usage is not done in parallel?  More
> specifically, if two
> templates are requested and created "at the same
> time" can this cause
> problems?  If the same template is used
> concurrently, can this cause
> problems?

there is velocity servlet - it uses velocity engine 
with runtime shared between threads. 

I'm using it in production ( and others too ) with no
problem so far. 

regards,

=====
----[ Konstantin Pribluda ( ko5tik ) ]----------------
Zu Verst�rkung meines Teams suche ich ab Sofort einen
Softwareentwickler[In] f�r die Festanstellung. 
Arbeitsort: Mainz 
Skills:  Programieren, Kentnisse in OpenSource-Bereich
----[ http://www.pribluda.de ]------------------------


	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org