public class WebappLoader extends LifecycleMBeanBase implements Loader, PropertyChangeListener
This class loader is configured by adding the pathnames of directories,
JAR files, and ZIP files with the addRepository()
method,
prior to calling start()
. When a new class is required,
these repositories 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 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.
|
WebappLoader(ClassLoader parent)
Deprecated.
Use
Container.setParentClassLoader(ClassLoader) to
specify the required class loader. This method will be
removed in Tomcat 10 onwards. |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
|
void |
addRepository(String repository)
Add a new repository to the set of repositories for this class loader.
|
void |
backgroundProcess()
Execute a periodic task, such as reloading, etc.
|
void |
closeJARs(boolean force)
Used to periodically signal to the classloader to release JAR resources.
|
String[] |
findRepositories()
Return the set of repositories defined for this class loader.
|
ClassLoader |
getClassLoader()
Return the Java class loader to be used by this Container.
|
String |
getClasspath()
Classpath, as set in org.apache.catalina.jsp_classpath context
property
|
Container |
getContainer()
Return the Container with which this Logger has been associated.
|
boolean |
getDelegate()
Return the "follow standard delegation model" flag used to configure
our ClassLoader.
|
protected String |
getDomainInternal()
Method implemented by sub-classes to identify the domain in which MBeans
should be registered.
|
String |
getInfo()
Return descriptive information about this Loader implementation and
the corresponding version number, in the format
<description>/<version> . |
int |
getJarOpenInterval()
Return the interval to keep all jar files open if no jar is accessed
|
String |
getLoaderClass()
Return the ClassLoader class name.
|
String[] |
getLoaderRepositories() |
String |
getLoaderRepositoriesString() |
protected 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.
|
String[] |
getRepositories() |
String |
getRepositoriesString()
Extra repositories for this loader
|
boolean |
getSearchExternalFirst() |
boolean |
modified()
Has the internal repository associated with this Loader been modified,
such that the loaded classes should be reloaded?
|
void |
propertyChange(PropertyChangeEvent event)
Process property change events from our associated Context.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
|
void |
setContainer(Container container)
Set the Container with which this Logger has been associated.
|
void |
setDelegate(boolean delegate)
Set the "follow standard delegation model" flag used to configure
our ClassLoader.
|
void |
setJarOpenInterval(int jarOpenInterval)
The interval to keep all jar files open if no jar is accessed
|
void |
setLoaderClass(String loaderClass)
Set the ClassLoader class name.
|
void |
setReloadable(boolean reloadable)
Set the reloadable flag for this Loader.
|
void |
setSearchExternalFirst(boolean searchExternalFirst) |
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() . |
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, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
protected static final StringManager sm
protected PropertyChangeSupport support
public WebappLoader()
Container.getParentClassLoader()
.@Deprecated public WebappLoader(ClassLoader parent)
Container.setParentClassLoader(ClassLoader)
to
specify the required class loader. This method will be
removed in Tomcat 10 onwards.parent
- The parent class loaderpublic ClassLoader getClassLoader()
getClassLoader
in interface Loader
public Container getContainer()
getContainer
in interface Loader
public void setContainer(Container container)
setContainer
in interface Loader
container
- The associated Containerpublic boolean getDelegate()
getDelegate
in interface Loader
public void setDelegate(boolean delegate)
setDelegate
in interface Loader
delegate
- The new flagpublic void setJarOpenInterval(int jarOpenInterval)
jarOpenInterval
- The new intervalpublic int getJarOpenInterval()
public String getInfo()
<description>/<version>
.public String getLoaderClass()
public void setLoaderClass(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 boolean getSearchExternalFirst()
public void setSearchExternalFirst(boolean searchExternalFirst)
searchExternalFirst
- Whether external repositories should be searched firstpublic void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface Loader
listener
- The listener to addpublic void addRepository(String repository)
addRepository
in interface Loader
repository
- Repository to be addedpublic void backgroundProcess()
backgroundProcess
in interface Loader
public String[] findRepositories()
findRepositories
in interface Loader
public String[] getRepositories()
public String getRepositoriesString()
public String[] getLoaderRepositories()
public String getLoaderRepositoriesString()
public String getClasspath()
public boolean modified()
public void closeJARs(boolean force)
public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface Loader
listener
- The listener to removepublic String toString()
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(PropertyChangeEvent event)
propertyChange
in interface PropertyChangeListener
event
- The property change event that has occurredprotected String getDomainInternal()
LifecycleMBeanBase
getDomainInternal
in class LifecycleMBeanBase
protected String getObjectNameKeyProperties()
LifecycleMBeanBase
ObjectName
that will be used to register this component.getObjectNameKeyProperties
in class LifecycleMBeanBase
ObjectName
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.