public class WebappLoader extends LifecycleMBeanBase implements Loader, java.beans.PropertyChangeListener
WebResourceRoot
).
This class loader supports detection of modified
Java classes, which can be used to implement auto-reload support.
This class loader is configured via the Resources children of its Context
prior to calling start()
. When a new class is required,
these Resources will be consulted first to locate the class. If it
is not present, the system class loader will be used instead.
Lifecycle.SingleUse
Modifier and Type | Field and Description |
---|---|
protected static StringManager |
sm
The string manager for this package.
|
protected java.beans.PropertyChangeSupport |
support
The property change support for this component.
|
mserver
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
WebappLoader()
Construct a new WebappLoader with no defined parent class loader
(so that the actual parent will be the system class loader).
|
WebappLoader(java.lang.ClassLoader parent)
Construct a new WebappLoader with the specified class loader
to be defined as the parent of the ClassLoader we ultimately create.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component.
|
void |
backgroundProcess()
Execute a periodic task, such as reloading, etc.
|
java.lang.ClassLoader |
getClassLoader()
Return the Java class loader to be used by this Container.
|
java.lang.String |
getClasspath()
Classpath, as set in org.apache.catalina.jsp_classpath context
property
|
Context |
getContext() |
boolean |
getDelegate()
Return the "follow standard delegation model" flag used to configure
our ClassLoader.
|
protected java.lang.String |
getDomainInternal()
Method implemented by sub-classes to identify the domain in which MBeans
should be registered.
|
java.lang.String |
getLoaderClass()
Return the ClassLoader class name.
|
java.lang.String[] |
getLoaderRepositories() |
java.lang.String |
getLoaderRepositoriesString() |
protected java.lang.String |
getObjectNameKeyProperties()
Allow sub-classes to specify the key properties component of the
ObjectName that will be used to register this component. |
boolean |
getReloadable()
Return the reloadable flag for this Loader.
|
boolean |
modified()
Has the internal repository associated with this Loader been modified,
such that the loaded classes should be reloaded?
|
void |
propertyChange(java.beans.PropertyChangeEvent event)
Process property change events from our associated Context.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.
|
void |
setContext(Context context)
Set the Context with which this Loader has been associated.
|
void |
setDelegate(boolean delegate)
Set the "follow standard delegation model" flag used to configure
our ClassLoader.
|
void |
setLoaderClass(java.lang.String loaderClass)
Set the ClassLoader class name.
|
void |
setReloadable(boolean reloadable)
Set the reloadable flag for this Loader.
|
protected void |
startInternal()
Start associated
ClassLoader and implement the requirements
of LifecycleBase.startInternal() . |
protected void |
stopInternal()
Stop associated
ClassLoader and implement the requirements
of LifecycleBase.stopInternal() . |
java.lang.String |
toString()
Return a String representation of this component.
|
destroyInternal, getDomain, getObjectName, initInternal, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop
protected static final StringManager sm
protected final java.beans.PropertyChangeSupport support
public WebappLoader()
public WebappLoader(java.lang.ClassLoader parent)
parent
- The parent class loaderpublic java.lang.ClassLoader getClassLoader()
getClassLoader
in interface Loader
public Context getContext()
getContext
in interface Loader
public void setContext(Context context)
Loader
setContext
in interface Loader
context
- The associated Contextpublic boolean getDelegate()
getDelegate
in interface Loader
public void setDelegate(boolean delegate)
setDelegate
in interface Loader
delegate
- The new flagpublic java.lang.String getLoaderClass()
public void setLoaderClass(java.lang.String loaderClass)
loaderClass
- The new ClassLoader class namepublic boolean getReloadable()
getReloadable
in interface Loader
public void setReloadable(boolean reloadable)
setReloadable
in interface Loader
reloadable
- The new reloadable flagpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface Loader
listener
- The listener to addpublic void backgroundProcess()
backgroundProcess
in interface Loader
public java.lang.String[] getLoaderRepositories()
public java.lang.String getLoaderRepositoriesString()
public java.lang.String getClasspath()
public boolean modified()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface Loader
listener
- The listener to removepublic java.lang.String toString()
toString
in class java.lang.Object
protected void startInternal() throws LifecycleException
ClassLoader
and implement the requirements
of LifecycleBase.startInternal()
.startInternal
in class LifecycleBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedprotected void stopInternal() throws LifecycleException
ClassLoader
and implement the requirements
of LifecycleBase.stopInternal()
.stopInternal
in class LifecycleBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- The property change event that has occurredprotected java.lang.String getDomainInternal()
LifecycleMBeanBase
getDomainInternal
in class LifecycleMBeanBase
protected java.lang.String getObjectNameKeyProperties()
LifecycleMBeanBase
ObjectName
that will be used to register this component.getObjectNameKeyProperties
in class LifecycleMBeanBase
ObjectName
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.