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 .