Got it, tnx! -----Original Message----- From: Geir Magnusson Jr [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 4:16 PM To: Velocity Developers List Subject: Re: is velocity thread safe?
On May 12, 2004, at 7:46 AM, Amir Zucker wrote: > Geir, > > I assume you were aiming at running under multi-threaded environments > and so provided synchronization where needed, this usually comes with a > penalty in performance (while obviously being needed of course), was > synchronization optimized when you built the system? Will it be > possible to serve multiple requests concurrently? Of course. In the beginning, it was clear that the primary use case for velocity was rendering templates into HTML for the web. Thus, we did our best to ensure that we synchronized where we needed to, and avoided it when we could. So yes, hammer away. Just don't use an outer instance of VelocityContext concurrently.... By that I mean you can nest a VC in a VC : VelocityContext myContext = new VelocityContext(toolContext); and toolContext can be shared, but myContext can't. geir geir > > Thanks, > > Amir > > > > -----Original Message----- > From: Geir Magnusson Jr [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 12, 2004 2:07 PM > To: Velocity Developers List > Subject: Re: is velocity thread safe? > > > 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) > [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Geir Magnusson Jr 203-247-1713(m) [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
