By the way, I found a solution to "shared context-aware objects" problem, that no one here mentioned. It's very simple (and is often used, I just overlooked it). It is to put current context into map of threads: Map threadContexts = new HashMap(); threadContexts.put( Thread.currentThread(), theContext );
AG> A lot of objects in the Context might need to use some context-specific AG> information, such as session, specific request parameters, AG> or something else put into the Context by someone. AG> And there is only a few ways for the object to receive this AG> information. One is to synchronize access to all objects in the AG> Context as a whole, that is, only one Velocity Context AG> might be merged into template at the time, so that we AG> can just give the Context to all the objects before merging it. AG> Other is for every new Context to create all the objects AG> from scratch and give the Context to each object thru object's AG> constructor. (I'll be glad to hear of another ways to accoplish this). AG> Described methods are surely inconvenient. AG> The first kills concurency and may produce user-visible hangs. AG> The second forces us to recreat all the objects in the Context, AG> which is not at all efficient, becouse memory allocation is never AG> cheap and objects might have some heavy initializers in constructors AG> or do some internal caching, which is humped when we recreate them, AG> and it is neither convenient nor efficient when we have to AG> create proxies to objects whoes number of instances should be limited, AG> instead of just placing those objects into the Context. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
