Daniel Rall wrote:
>
> "Geir Magnusson Jr." <[EMAIL PROTECTED]> writes:
>
> > Note also that you get your own ArrayList when you #set() or just pass
> > one to a method, so there should be no fear of inter-thread problems.
> > Muck with it to your hearts content.
>
> But remember that ArrayList itself is not synchronized! :)
I don't understand why this matters, so if I am missing something,
please, lets get this straightened out.
When I said above that one should have no fear of inter-thread problems,
I meant that when you have a template that has
#set( $foo = ["a","b","c"] )
each thread (say a request to a servlet) merging that template will get
a new ArrayList placed in that thread's context. Therefore, each thread
of execution can do what it wishes with that ArrayList w/o fear of
affecting any other thread. (I think... :\ )
Since 'the rule' is that the context must not be used/shared
simultaneously across threads, it doesn't matter that ArrayList isn't
synchronized. ( Aside from being a horrible idea anyway, one of the
reasons for 'the rule' is that the VelocityContext default context
implementation uses a HashMap, which isn't synchronized :)
Anyway, if there is something I am missing here...
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity