## com.sun.appserv
Class ClassLoaderUtil

    java.lang.Object
      com.sun.appserv.ClassLoaderUtil

    public class ClassLoaderUtil

extends Object

Provides utility functions related to URLClassLoaders or subclasses of it. W A R N I N G This class uses undocumented, unpublished, private data structures inside java.net.URLClassLoader and sun.misc.URLClassPath. Use with extreme caution.

Author:
  tjquinn

Constructor Summary
`ClassLoaderUtil()`

Method Summary
`static void` `releaseLoader(URLClassLoader classLoader)` Releases resources held by the URLClassLoader.
`static IOException[]` `releaseLoader(URLClassLoader classLoader, Vector<String> jarsClosed)` Releases resources held by the URLClassLoader.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClassLoaderUtil

    public ClassLoaderUtil()

Method Detail

### releaseLoader

    public static void releaseLoader(URLClassLoader classLoader)

  Releases resources held by the URLClassLoader. Notably, close the jars opened by the loader. This does not prevent the class loader from continuing to return classes it has already resolved.

  Parameters:
    `classLoader` - the instance of URLClassLoader (or a subclass)

### releaseLoader

    public static IOException[] releaseLoader(URLClassLoader classLoader,
                                              Vector<String> jarsClosed)

  Releases resources held by the URLClassLoader. Notably, close the jars opened by the loader. This does not prevent the class loader from continuing to return classes it has alrady resolved although that is not what we intend to happen. Initializes and updates the Vector of jars that have been successfully closed.

  Any errors are logged.

  Parameters:
    `classLoader` - the instance of URLClassLoader (or a subclass)
    `jarsClosed` - a Vector of Strings that will contain the names of jars successfully closed; can be null if the caller does not need the information returned
  Returns:
    array of IOExceptions reporting jars that failed to close; null indicates that an error other than an IOException occurred attempting to release the loader; empty indicates a successful release; non-empty indicates at least one error attempting to close an open jar.

Copyright © 2008 Mort Bay Consulting. All Rights Reserved.