// Catch both the null scenario and the
// RequestContext-from-a-different-classloader scenario
if (cachedRequestContext instanceof RequestContext)
{
context = (RequestContext) cachedRequestContext;
context.attach();
}
else
{
final RequestContextFactory factory = RequestContextFactory.getFactory();
assert factory != null;