to.etc.domui.server.reloader
Class Reloader

java.lang.Object
  extended by to.etc.domui.server.reloader.Reloader

public final class Reloader
extends java.lang.Object

This class handles loading classes in such a way that when their source .class files change we discard existing info and cause the classes to be reloaded. Used in development.

Application class chores

The DomApplication class is responsible for instantiating all user-changeable classes by converting strings to Class instances. This DomApplication class itself is not reloadable (for now), but it's classloader must pass all loads to the classloader here so we can determine if a class is to be reloadable.

We have a total of three ClassLoaders in this process:

Author:
Frits Jalvingh Created on May 22, 2008

Constructor Summary
Reloader(java.lang.String paths)
          Create a reloader which handles the specified classes.
 
Method Summary
 void clear()
           
 java.lang.ClassLoader getReloadingLoader()
           
 java.net.URL[] getUrls()
           
 boolean isChanged()
          Checks for changes on this classloader.
 java.lang.Class<DomApplication> loadApplication(java.lang.String classname)
          Used to load the Application class so it uses the proper ClassLoader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reloader

public Reloader(java.lang.String paths)
Create a reloader which handles the specified classes.

Parameters:
paths -
Method Detail

getUrls

public java.net.URL[] getUrls()

getReloadingLoader

public java.lang.ClassLoader getReloadingLoader()

loadApplication

public java.lang.Class<DomApplication> loadApplication(java.lang.String classname)
                                                throws java.lang.Exception
Used to load the Application class so it uses the proper ClassLoader.

Parameters:
classname -
Returns:
Throws:
java.lang.Exception

isChanged

public boolean isChanged()
Checks for changes on this classloader. This blocks if another thread is checking and if so it does not sweep again when that thread completes the sweep.


clear

public void clear()