|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
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 . |
Provides classes for advanced class loading.
Usage
controller
class.
There are four controllers that come with this package, new controllers can be
easily developed, just implement LoadController
interface.
Reloader
object, pass the controller as a parameter.
reload
of the
reloader. Reloader
loads the class that was passed to reload
method and, depending on the controller, classes used by this class. In the
example below, testClass
calls the method of the testClass2
,
so testClass2
will be reloaded as well.
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()
.
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |