You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Larry Streepy <la...@staffmix.com> on 2004/02/17 22:16:29 UTC
Global object creation
I'm trying to decipher when I would use an application extension versus the
Global object and I stumbled across what looks like a bug (I'm probably
missing something).
In AbstractEngine.setupForRequest(RequestContext context), there is this
code:
if (_global == null) {
String name = GLOBAL_NAME + ":" + servletName;
_global = servletContext.getAttribute(name);
if (_global == null)
{
_global = createGlobal(context);
servletContext.setAttribute(name, _global);
}
}
And in createGlobal, it just extracts the global class name and instantiates
a new instance. So, here's my question: This isn't a thread safe piece of
code (nothing is synchronized), so what prevents the possibility of creating
multiple Global objects?
Thanks.
Larry.