From: Keats K. <ke...@xa...> - 2005-12-08 15:34:28
|
[Resending ... looks like I accidentally replied to Eric only.] -------- Original Message -------- I agree with Eric. WM has always been designed to keep all of the "state" information in the Context so that it can be shared by multiple threads of execution without locking. Personally I'd suggest a singleton rather than a static instance, but that's a religious preference. Glad to see you're back on the scene. Keats PS, Congratulations on the 2nd daughter. I have two little girls myself and it rocks! Eric B. Ridge wrote: > On Dec 7, 2005, at 1:01 PM, Marc Palmer wrote: > >> However the JSP suffers a problem. Every JSP page you have that uses >> the Webmacro tag will currently have its own WM instance. This is of >> course rather heavyweight. > > > I don't think that's entirely true. I think all WM instances created > with the same arguments (ie, same .properties file configuration) > all share a single Broker instance. Broker is the real heavy-weight > guy anyways. WM is a pretty light-weight wrapper. I know that WM > used to work this way. Maybe it's changed and I forgot? > >> The obvious workaround is to synchronize on a static lock object and >> allocate a shared static WM instance. >> >> However this will throttle performance badly as every page that uses >> WM will effectively be serialized in access - rendering only one >> client's instance of the page at a time. > > > That's not true either. Requests would only be serialized around the > accessor method that returns the "shared" WM instance. And if you > instantiate that WM instance statically, there'd be no need to > serialize at all. > > eric > > > > > >> The solution must be buried in the concurrent stuff but I haven't >> got time to look it up. >> >> Anybody got any clues for me? Basically we just need the common >> pattern of allocating a shared static object only once, in a thread- >> safe manner. >> >> Thanks in advance. I'm ready to commit this stuff as experimental... >> >> >> ~ ~ ~ >> Marc Palmer (ma...@an...) >> Consultant/Analyst >> AnyWare Ltd. >> http://www.anyware.co.uk/ >> |