public Context getInitialContext(Hashtable environment)
throws NamingException {
if (ContextBindings.isThreadBound() ||
(ContextBindings.isClassLoaderBound())) {
// Redirect the request to the bound initial context
return new SelectorContext(environment, true);
} else {
// If the thread is not bound, return a shared writable context
if (initialContext == null)
initialContext = new NamingContext(environment, MAIN);
return initialContext;