"Geir Magnusson Jr." wrote:
> To summarize my view - I think we should go for a more conventional approach to
>this, because having to worry about threading issues seems to be a bit much...
1. For most apps (Anakia/Texen/servlet using 1 engine) there is
absolutly *nothing* to worry about.
2. For multi threaded/multi engine scenarios (Trubine & other
frameworks) the only thing that
you need to do is to call someRuntime.useRuntime() when the thread of
control enters your
code. And this is done by the framework, not the application code, so
it't not a problem
either.
> By 'conventional', I mean simply being able to 'new' or use a factory to get a 'free
>and clear' instance of the Velocity engine, i.e.
>
> Vel vel = new Vel( initProperties );
That's pretty much what you need to do if you want to juggle Runtimes
directly...
> and not add complexity by bulding in threading dependence.
As an alternative, all objects (Contexts, Templates, AST nodes etc)
would have
to hold explicit references to the Runtime they belong to. Both
approaches
are valid, but Thread->Runtime mapping solution was much easier to
implement with
the existing codebase :-)
> I will be able to engage better on this when I can stop typing into a <textarea>
Poor you ;-)
Rafal
--
Rafal Krzewski
Senior Internet Developer
mailto:[EMAIL PROTECTED]
+48 22 8534830 http://e-point.pl