php.java.bridge
Class DynamicClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by php.java.bridge.DynamicClassLoader

public class DynamicClassLoader
extends java.security.SecureClassLoader

This class implements a class loader, which keeps track of a dynamic list of other delegate URLClassLoaders It is possible to change the list of these Classloaders during execution. The classloaders themselves, as well as their corresponding classes are globally cached.

In case of file:// URLs, this classloader also handles reloading of Jar-Files once they are modified. This is possible without restarting the JVM It keeps track of the latest file modification times, and reloads Jar files if neccessary. It is also possible to add an URL pointing to a directory of simple class files. This is slow, though, and only recommended for quick and dirty development use since it will *always* reload

Copyright: PHP-License

http://sourceforge.net/projects/php-java-bridge

Version:
2.06
Author:
Kai Londenberg

Field Summary
static long defaultCacheTimeout
          By default minumum file modification check interval is 2 seconds, that should be fast enough :)
static boolean defaultLazy
          By default lazy classpath addition
 
Method Summary
static void destroyObserver()
          Destroy the temp file observer.
static void invalidate(java.lang.String classpath)
          Invalidates a given classpath, so that the corresponding classloader gets reloaded.
static void invalidate(java.net.URL[] urls)
          Invalidates a given classpath, so that the corresponding classloader gets reloaded.
 java.lang.Class loadClass(java.lang.String name)
          I have decided to override loadClass instead of findClass, so that this method will actually get to re-load classes if necessary.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultCacheTimeout

public static long defaultCacheTimeout
By default minumum file modification check interval is 2 seconds, that should be fast enough :)


defaultLazy

public static boolean defaultLazy
By default lazy classpath addition

Method Detail

invalidate

public static void invalidate(java.net.URL[] urls)
Invalidates a given classpath, so that the corresponding classloader gets reloaded.

Parameters:
urls - The urls.

invalidate

public static void invalidate(java.lang.String classpath)
Invalidates a given classpath, so that the corresponding classloader gets reloaded. This method should be called from PHP to signal that a given codebase has been modified.

Parameters:
classpath -

destroyObserver

public static final void destroyObserver()
Destroy the temp file observer. Should be called before the class is unloaded (in servlet.destroy() for example).


loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
I have decided to override loadClass instead of findClass, so that this method will actually get to re-load classes if necessary. Otherwise, the Java system would call the final method "getLoadedClass(name)", (i.e. use it's own caching) without dynamically re-loading classes if necessary.

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
name - The class name
Returns:
The class
Throws:
java.lang.ClassNotFoundException