On Tue, Aug 31, 2010 at 10:02 PM, Kitching, Simon <simon.kitch...@airnz.co.nz> wrote: > Hi All, > > I've got some code using Velocity which failed under load. Can you > confirm that the Velocity class is meant to be thread-safe? If so, I'll > file a bugreport.
generally, yes, but velocimacro settings can break that. what are your velocity properties? > Scenario: > * Velocity version 1.6.1, java 1.6, linux > (also fails with velocity-1.6.4) > * Using a complex template with macros > * Using a separate context object per thread > * Invoking Velocity.evaluate(context, out, "", templateText) > > Results: > * Under heavy load from single thread, all ok > * Under light load from multiple threads, all ok > * Under heavy load from multiple threads, macro references like > "#macroname" intermittently don't get invoked during template > processing; the "#macroname" text appears literally in the output > instead. sure sounds like a bug to me. > Simply replacing calls to > Velocity.evaluate(...) > with > VelocityEngine ve = new VelocityEngine(); > ve.init(props); > ve.evaluate(...) > fixes the issue. > > I've confirmed the problem with a unit test; I can simplify it and > submit it if this really is considered a bug. yes, please. > >From the documentation, email lists, etc. I believe that using the > Velocity singleton *should* have worked here (we don't need multiple > velocity configurations). > > > Comments? > > Regards, > Simon > > Good planets are hard to find - please think of the environment before you > print this email. > ____________________________________________________________________ > CAUTION - This message may contain privileged and confidential > information intended only for the use of the addressee named above. > If you are not the intended recipient of this message you are hereby > notified that any use, dissemination, distribution or reproduction > of this message is prohibited. If you have received this message in > error please notify Air New Zealand immediately. Any views expressed > in this message are those of the individual sender and may not > necessarily reflect the views of Air New Zealand. > _____________________________________________________________________ > For more information on the Air New Zealand Group, visit us online > at http://www.airnewzealand.com > _____________________________________________________________________ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org > For additional commands, e-mail: user-h...@velocity.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org