Package com.myarch.reloader

Provides classes for advanced class loading.

See:
          Description

Interface Summary
Actions Defines load/reload action constants used by the LoadActionListener (logger).
LoadActionListener LoadActionListener can be used to develop loggers.
LoadController After Reloader.reload() was called and the main class was loaded, JVM uses the main class' class loader for all classes that the main class uses (calls, extends or refers to).
 

Class Summary
ClassCollectionController Allows for loading the classes listed with ClassCollectionController.
ExceptionCollectionController Allows for loading only the classes NOT listed with ExceptionCollectionController.
ReloadAllController Makes Reloader to re-load all classes passed to it.
Reloader Performs dynamic class loading (reloading).
ReloadLogger Logs AFTER_RELOAD event produced by Reloader after it successfully loads a class.
ReloadMainController Makes Reloader to re-load only the main class.
ReloadPackageController Allows loading all classes in the packages listed with ReloadPackageController.
 

Package com.myarch.reloader Description

Provides classes for advanced class loading.

Usage

Example:

   // reload the specified list of classes
   
   // instantiate with the list of one class
   ClassCollectionController classCtl = new ClassCollectionController( testClass );
   // add another class to the list
   classCtl.addClass(testClass2);
   Reloader  reloader = new Reloader( classCtl );
   // reload testClass and testClass2
   TestIface tst = (TestIface) reloader.reload( testClass ).newInstance();
   tst.print();
  
    

Logging. Reloader can log a number of events, such as "before loading", "after loading" and so on. By default the logging is off. To turn it on, set the following property:
reloader.log=yes
In other words:
java -Dreloader.log=yes
Alternatively use the static methods ReloadLogger.setLogginOn() or ReloadLogger.setLogginOff().
Changing logging setting has effect on all instances of Reloader class.

Custom loggers can be created by implementing the LoadActionListener interface. ReloadLogger is the default logger.

Reloading on/off. You might want to turn the reloading off in the production system (the default is on). Naturally, keeping reloading on has some (albeit minor) overhead as the new instance of a class loader needs to be created for every reload() call. To turn the reloading off, set the following property:
reloader.reload=no
In other words:
java -Dreloader.reload=no
Alternatively you can use static methods Reloader.setReloadOff() or Reloader.setReloadOn().



Copyright © 2001 Alexander Ananiev & MyArch.com. All Rights Reserved.