winstone.classLoader
Class ReloadingClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by winstone.classLoader.WebappClassLoader
                  extended by winstone.classLoader.ReloadingClassLoader
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, ServletContextListener

public class ReloadingClassLoader
extends WebappClassLoader
implements ServletContextListener, java.lang.Runnable

This subclass of WinstoneClassLoader is the reloading version. It runs a monitoring thread in the background that checks for updates to any files in the class path.

Version:
$Id: ReloadingClassLoader.java,v 1.11 2007/02/17 01:55:12 rickknowles Exp $
Author:
Rick Knowles

Field Summary
 
Fields inherited from class winstone.classLoader.WebappClassLoader
system
 
Constructor Summary
ReloadingClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)
           
 
Method Summary
protected  void addURL(java.net.URL url)
           
 void contextDestroyed(ServletContextEvent sce)
           
 void contextInitialized(ServletContextEvent sce)
           
protected  java.lang.Class findClass(java.lang.String name)
           
 java.net.URL findResource(java.lang.String name)
           
 void run()
          The maintenance thread.
 
Methods inherited from class winstone.classLoader.WebappClassLoader
getResourceAsStream, loadClass
 
Methods inherited from class java.net.URLClassLoader
definePackage, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReloadingClassLoader

public ReloadingClassLoader(java.net.URL[] urls,
                            java.lang.ClassLoader parent)
Method Detail

addURL

protected void addURL(java.net.URL url)
Overrides:
addURL in class java.net.URLClassLoader

contextInitialized

public void contextInitialized(ServletContextEvent sce)
Specified by:
contextInitialized in interface ServletContextListener

contextDestroyed

public void contextDestroyed(ServletContextEvent sce)
Specified by:
contextDestroyed in interface ServletContextListener

run

public void run()
The maintenance thread. This makes sure that any changes in the files in the classpath trigger a classLoader self destruct and recreate.

Specified by:
run in interface java.lang.Runnable

findClass

protected java.lang.Class findClass(java.lang.String name)
                             throws java.lang.ClassNotFoundException
Overrides:
findClass in class java.net.URLClassLoader
Throws:
java.lang.ClassNotFoundException

findResource

public java.net.URL findResource(java.lang.String name)
Overrides:
findResource in class java.net.URLClassLoader


Copyright © 2013. All Rights Reserved.