equal
deleted
inserted
replaced
1971 * case, the CLR remembers the loader for use when it is |
1971 * case, the CLR remembers the loader for use when it is |
1972 * explicitly named (e.g. as the loader in createMBean) but |
1972 * explicitly named (e.g. as the loader in createMBean) but |
1973 * does not add it to the list that is consulted by |
1973 * does not add it to the list that is consulted by |
1974 * ClassLoaderRepository.loadClass. |
1974 * ClassLoaderRepository.loadClass. |
1975 */ |
1975 */ |
1976 final ModifiableClassLoaderRepository clr = |
1976 final ModifiableClassLoaderRepository clr = getInstantiatorCLR(); |
1977 instantiator.getClassLoaderRepository(); |
|
1978 if (clr == null) { |
1977 if (clr == null) { |
1979 final RuntimeException wrapped = |
1978 final RuntimeException wrapped = |
1980 new IllegalArgumentException( |
1979 new IllegalArgumentException( |
1981 "Dynamic addition of class loaders" + |
1980 "Dynamic addition of class loaders" + |
1982 " is not supported"); |
1981 " is not supported"); |
1998 final ObjectName logicalName) { |
1997 final ObjectName logicalName) { |
1999 /** |
1998 /** |
2000 * Removes the MBean from the default loader repository. |
1999 * Removes the MBean from the default loader repository. |
2001 */ |
2000 */ |
2002 if (loader != server.getClass().getClassLoader()) { |
2001 if (loader != server.getClass().getClassLoader()) { |
2003 final ModifiableClassLoaderRepository clr = |
2002 final ModifiableClassLoaderRepository clr = getInstantiatorCLR(); |
2004 instantiator.getClassLoaderRepository(); |
|
2005 if (clr != null) { |
2003 if (clr != null) { |
2006 clr.removeClassLoader(logicalName); |
2004 clr.removeClassLoader(logicalName); |
2007 } |
2005 } |
2008 } |
2006 } |
2009 } |
2007 } |
2058 logicalName); |
2056 logicalName); |
2059 } |
2057 } |
2060 return ResourceContext.NONE; |
2058 return ResourceContext.NONE; |
2061 } |
2059 } |
2062 |
2060 |
2063 |
2061 private ModifiableClassLoaderRepository getInstantiatorCLR() { |
|
2062 return AccessController.doPrivileged(new PrivilegedAction<ModifiableClassLoaderRepository>() { |
|
2063 @Override |
|
2064 public ModifiableClassLoaderRepository run() { |
|
2065 return instantiator != null ? instantiator.getClassLoaderRepository() : null; |
|
2066 } |
|
2067 }); |
|
2068 } |
2064 } |
2069 } |