velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niall Gallagher <niall.gallag...@analog.com>
Subject Re: Synchronizing a Context
Date Tue, 20 Jan 2004 13:19:31 GMT
> I am relatively new to Velocity and I have been trying to write a 
> shared Context for a group of Servlets. However, I see in the Javadoc 
> documentation that the VelocityContext object is not thread safe, I 
> have also examined the hierarchy of super classes and find that it 
> pretty much comes down to the InternalContextBase.icachePut and 
> InternalContextBase.icacheGet methods.

>>
>> Perhaps I didn't catch the point ... but ...
>> what if you synchronize the methods accessing your context object?
>
>
> That might work, but that would be solving a slightly different 
> problem, right?  aren't you trying to share some of your application 
> data between servlets?
>
> geir
>
Exactly, so if I did somthing like  
servletContext.setAttribute("sharedContext", mySharedContext) and 
multiple independant servlets required access to the context to render a 
template, then there would be a problem with the AST caching and also 
setting and getting from the context...at least this is what I have 
understood of the AbstractContext.

Niall


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


Mime
View raw message