naming/src/main/java/org/jboss/as/naming/InitialContext.java
public static synchronized void removeUrlContextFactory(final String scheme, ObjectFactory factory) {
        Map<String, ObjectFactory> factories = new HashMap<String, ObjectFactory>(urlContextFactories);

        ObjectFactory f = factories.get(scheme);
        if (f == factory) {
            factories.remove(scheme);
            urlContextFactories = Collections.unmodifiableMap(factories);
            return;
        } else {
            throw new IllegalArgumentException();
        }
    }
public static synchronized void removeUrlContextFactory(final String scheme, ObjectFactory factory) {
        Map<String, ObjectFactory> factories = new HashMap<String, ObjectFactory>(urlContextFactories);

        ObjectFactory f = factories.get(scheme);
        if (f == factory) {
            factories.remove(scheme);
            urlContextFactories = Collections.unmodifiableMap(factories);
            return;
        } else {
            throw new IllegalArgumentException();
        }
    }
Remove an ObjectFactory from the map of registered ones. To make sure that not anybody can remove an
ObjectFactory both the scheme as well as the actual object factory itself need to be supplied. So you
can only remove the factory if you have the factory object.
@param scheme The URL scheme for which the handler is registered.
@param factory The factory object associated with the scheme
@throws IllegalArgumentException if the requested scheme/factory combination is not registered.