com.myarch.reloader
Class ExceptionCollectionController
java.lang.Object
|
+--com.myarch.reloader.ClassCollectionController
|
+--com.myarch.reloader.ExceptionCollectionController
- All Implemented Interfaces:
- LoadController
- public class ExceptionCollectionController
- extends ClassCollectionController
Allows for loading only the classes NOT listed with ExceptionCollectionController
.
In other words, all classes that can't be reloaded should be specified.
You don't need to explicitly list java.lang
classes, such as
java.lang.Object
. These classes throw SecurityException
on the attempt to reload, so Reloader
immediately passes them on to
the parent loader.
If you choose not to specify java.lang
classes, default
JVM library (${java_home}/jre/lib/rt.jar) should be explicitly added to the classpath.
- Author:
- Alexander Ananiev
Method Summary |
boolean |
isLoadByParentAllowed(java.lang.String className,
java.lang.String mainClassName,
java.lang.ClassLoader loader)
Prohibits using parent loader for loadable classes.
|
boolean |
isReloadAllowed(java.lang.String className,
java.lang.String mainClassName,
java.lang.ClassLoader loader)
Returns true if a class is NOT among the classes in the class list |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExceptionCollectionController
public ExceptionCollectionController()
- Constructs a new
ExceptionCollectionController
with the empty
class list.
ExceptionCollectionController
public ExceptionCollectionController(java.util.Collection classes)
- Constructs a new
ExceptionCollectionController
with the
specified collection of classes.
- Parameters:
classes
- collection of classes that can't be re-loaded
ExceptionCollectionController
public ExceptionCollectionController(java.lang.String pClass)
- Constructs a new
ExceptionCollectionController
with a class list
containing a single class.
- Parameters:
pClass
- class name that can't be re-loaded
isReloadAllowed
public boolean isReloadAllowed(java.lang.String className,
java.lang.String mainClassName,
java.lang.ClassLoader loader)
- Returns
true
if a class is NOT among the classes in the class list
- Overrides:
isReloadAllowed
in class ClassCollectionController
- Parameters:
className
- class name to loadmainClassName
- name of the "main" class.
Main class is a class passed as a parameter to Reloader.reload()
method.loader
- the actual class loader used to load a class.- Returns:
true
if class className
is allowed to be loaded.
isLoadByParentAllowed
public boolean isLoadByParentAllowed(java.lang.String className,
java.lang.String mainClassName,
java.lang.ClassLoader loader)
- Prohibits using parent loader for loadable classes.
This ensures that the class is either loaded
by the
Reloader
or ClassNotFoundException
is thrown.
- Overrides:
isLoadByParentAllowed
in class ClassCollectionController
- Parameters:
className
- class name to loadmainClassName
- name of the "main" class.
Main class is a class passed as a parameter to Reloader.reload()
method.loader
- the actual class loader used to load a class (parent loader).- Returns:
false
all the time to prohibit using the parent loader.
Copyright © 2001 Alexander Ananiev & MyArch.com. All Rights Reserved.