public interface Reloader
Provides control and notification over/on class loading and reloading.
To use acquire an instance from the ReloaderFactory.
ReloaderFactory.getInstance()
.addClassReloadListener(new ClassEventListener() {
public void onClassEvent(int eventType, Class klass) {
System.out.println(
"Class '" + klass.getName() + "' was reloaded!");
}
});
ReloaderFactory,
Integration,
Configuration,
Logger,
Plugin| Modifier and Type | Method and Description |
|---|---|
void |
addBeforeReloadCheck(Runnable beforeReloadCheck)
Register a
Runnable to receive notifications before
we start reloading all the changed classes. |
void |
addClassLoadListener(ClassEventListener listener)
Register a
ClassEventListener to receive notifications when managed classes are loaded. |
void |
addClassReloadListener(Class<?>[] classes,
ClassEventListener listener)
Register a
ClassEventListener to receive notifications when one of the given managed classes is reloaded. |
void |
addClassReloadListener(Class<?> klass,
ClassEventListener listener)
Register a
ClassEventListener to receive notifications when the given managed class is reloaded. |
void |
addClassReloadListener(ClassEventListener listener)
Register a
ClassEventListener to receive notifications when managed classes are reloaded. |
void |
addClassReloadListener(Reference<? extends ClassEventListener> listener)
Register a
ClassEventListener to receive notifications when managed classes are reloaded. |
void |
addDependencyReloadListener(Class<?> klass,
Class<?>[] dependencies,
ClassEventListener listener)
Register a
ClassEventListener to receive notifications when
one of the given managed dependent classes is reloaded. |
void |
addHierarchyReloadListener(Class<?> klass,
ClassEventListener listener)
Register a
ClassEventListener to receive notifications when the given managed class,
it's super class or any of it's interfaces is reloaded. |
void |
addReloadCheckListener(Class<?> klass,
ReloadCheckListener listener)
Deprecated.
|
void |
blockReloadListeners(int priority)
Block reloads with priority lower than given from executing before current reload listener has completed.
|
boolean |
checkAndReload(Class<?> klass)
Causes a class to be reloaded if (and only if) the
underlying ".class" file has been updated.
|
void |
forceCheck()
Ensure that classes are checked for changes even when previous
check was just performed.
|
boolean |
isReloadableClass(Class<?> klass)
Returns whether this particular class is managed by JRebel and will be reloaded when it's updated.
|
boolean |
isReloadEnabled()
Returns whether reloading is enabled generally.
|
boolean |
isReloadingClass(Class<?> klass)
Returns whether this particular class is currently being reloaded.
|
void |
reinitClass(Class<?> klass) |
void |
reinitOnReload(Class<?> klass) |
void |
reinitOnReload(String className) |
void |
removeClassLoadListener(ClassEventListener listener)
Deregister a
ClassEventListener. |
void |
removeClassReloadListener(ClassEventListener listener)
Deregister a
ClassEventListener. |
void |
removeClassReloadListener(Reference<? extends ClassEventListener> listener)
Deregister a
ClassEventListener. |
void |
triggerClassReload()
Notify that some class has been reloaded or that it will be reloaded.
|
void |
waitForReload()
In case change detection is performed in a background thread wait for
change detection and reload to complete.
|
boolean isReloadEnabled()
boolean isReloadableClass(Class<?> klass)
klass - Any class.boolean isReloadingClass(Class<?> klass)
true while the ClassEventListener-s receive the events.klass - Class managed by JRebel.boolean checkAndReload(Class<?> klass)
Causes a class to be reloaded if (and only if) the underlying ".class" file has been updated. Returns true if reloaded, false otherwise.
Note, that as JRebel is lazy, such checks may be necessary
if you want to be sure that your metadata is up-to-date.
The ClassEventListener will only fire after JRebel
has reloaded the class, which by default occurs on method
calls to the class in question (and some reflection methods).
klass - The class to check.ClassEventListenervoid forceCheck()
void triggerClassReload()
void waitForReload()
void addReloadCheckListener(Class<?> klass, ReloadCheckListener listener)
addDependencyReloadListener(Class, Class[], ClassEventListener) instead.ReloadCheckListener to receive notifications when last modified time is being checked.klass - The class being checked.void addClassLoadListener(ClassEventListener listener)
ClassEventListener to receive notifications when managed classes are loaded.void removeClassLoadListener(ClassEventListener listener)
ClassEventListener.void addClassReloadListener(ClassEventListener listener)
ClassEventListener to receive notifications when managed classes are reloaded.void addClassReloadListener(Reference<? extends ClassEventListener> listener)
ClassEventListener to receive notifications when managed classes are reloaded.
This method accepts Weak/Soft references.void addClassReloadListener(Class<?> klass, ClassEventListener listener)
ClassEventListener to receive notifications when the given managed class is reloaded.void addClassReloadListener(Class<?>[] classes, ClassEventListener listener)
ClassEventListener to receive notifications when one of the given managed classes is reloaded.void addDependencyReloadListener(Class<?> klass, Class<?>[] dependencies, ClassEventListener listener)
ClassEventListener to receive notifications when
one of the given managed dependent classes is reloaded.
When the given class is being checked the dependencies are automatically checked,
The registered listener will be provided with the registered class
(not a dependency just reloaded).void addHierarchyReloadListener(Class<?> klass, ClassEventListener listener)
ClassEventListener to receive notifications when the given managed class,
it's super class or any of it's interfaces is reloaded.
When the given class is being checked the dependencies are automatically checked,
The registered listener will be provided with the registered class
(not a dependency just reloaded).void addBeforeReloadCheck(Runnable beforeReloadCheck)
Runnable to receive notifications before
we start reloading all the changed classes.
Sometimes we need to re-create some state before class reloads,
because some classes need to be transformed at load time based on the statevoid removeClassReloadListener(ClassEventListener listener)
ClassEventListener.void removeClassReloadListener(Reference<? extends ClassEventListener> listener)
ClassEventListener.
This method accepts Weak/Soft references.void reinitClass(Class<?> klass)
void reinitOnReload(Class<?> klass)
void reinitOnReload(String className)
void blockReloadListeners(int priority)
priority - Copyright © 2019. All rights reserved.