public final class StandardServer extends LifecycleMBeanBase implements Server
Lifecycle.SingleUse| Modifier and Type | Field and Description |
|---|---|
protected int |
periodicEventDelay
The lifecycle event period in seconds.
|
protected int |
utilityThreads
The number of threads available to process utility tasks in this service.
|
protected boolean |
utilityThreadsAsDaemon
The utility threads daemon flag.
|
mserverAFTER_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 |
|---|
StandardServer()
Construct a default instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component.
|
void |
addService(Service service)
Add a new Service to the set of defined Services.
|
void |
await()
Wait until a proper shutdown command is received, then return.
|
protected void |
destroyInternal()
Sub-classes wishing to perform additional clean-up should override this
method, ensuring that super.destroyInternal() is the last call in the
overriding method.
|
Service |
findService(java.lang.String name)
Find the specified Service
|
Service[] |
findServices() |
java.lang.String |
getAddress()
Return the address on which we listen to for shutdown commands.
|
Catalina |
getCatalina()
Return the outer Catalina startup/shutdown component if present.
|
java.io.File |
getCatalinaBase() |
java.io.File |
getCatalinaHome() |
protected java.lang.String |
getDomainInternal()
Obtain the MBean domain for this server.
|
javax.naming.Context |
getGlobalNamingContext()
Return the global naming resources context.
|
NamingResourcesImpl |
getGlobalNamingResources()
Return the global naming resources.
|
java.lang.Object |
getNamingToken() |
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. |
java.lang.ClassLoader |
getParentClassLoader()
Return the parent class loader for this component.
|
int |
getPeriodicEventDelay() |
int |
getPort()
Return the port number we listen to for shutdown commands.
|
int |
getPortOffset()
Get the number that offsets the port used for shutdown commands.
|
int |
getPortWithOffset()
Get the actual port on which server is listening for the shutdown commands.
|
java.lang.String |
getServerBuilt()
Return the current server built timestamp
|
java.lang.String |
getServerInfo()
Report the current Tomcat Server Release number
|
java.lang.String |
getServerNumber()
Return the current server's version number.
|
javax.management.ObjectName[] |
getServiceNames() |
java.lang.String |
getShutdown()
Return the shutdown command string we are waiting for.
|
java.util.concurrent.ScheduledExecutorService |
getUtilityExecutor() |
int |
getUtilityThreads()
Get the utility thread count.
|
boolean |
getUtilityThreadsAsDaemon()
Get if the utility threads are daemon threads.
|
protected void |
initInternal()
Invoke a pre-startup initialization.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.
|
void |
removeService(Service service)
Remove the specified Service from the set associated from this
Server.
|
void |
setAddress(java.lang.String address)
Set the address on which we listen to for shutdown commands.
|
void |
setCatalina(Catalina catalina)
Set the outer Catalina startup/shutdown component if present.
|
void |
setCatalinaBase(java.io.File catalinaBase)
Set the configured base (instance) directory.
|
void |
setCatalinaHome(java.io.File catalinaHome)
Set the configured home (binary) directory.
|
void |
setGlobalNamingContext(javax.naming.Context globalNamingContext)
Set the global naming resources context.
|
void |
setGlobalNamingResources(NamingResourcesImpl globalNamingResources)
Set the global naming resources.
|
void |
setParentClassLoader(java.lang.ClassLoader parent)
Set the parent class loader for this server.
|
void |
setPeriodicEventDelay(int periodicEventDelay)
Set the new period between two lifecycle events in seconds.
|
void |
setPort(int port)
Set the port number we listen to for shutdown commands.
|
void |
setPortOffset(int portOffset)
Set the number that offsets the server port used for shutdown commands.
|
void |
setShutdown(java.lang.String shutdown)
Set the shutdown command we are waiting for.
|
void |
setUtilityThreads(int utilityThreads)
Set the utility thread count.
|
void |
setUtilityThreadsAsDaemon(boolean utilityThreadsAsDaemon)
Set the utility threads daemon flag.
|
protected void |
startInternal()
Start nested components (
Services) and implement the requirements
of LifecycleBase.startInternal(). |
protected void |
startPeriodicLifecycleEvent() |
void |
stopAwait() |
protected void |
stopInternal()
Stop nested components (
Services) and implement the requirements
of LifecycleBase.stopInternal(). |
void |
storeConfig()
Write the configuration information for this entire
Server
out to the server.xml configuration file. |
void |
storeContext(Context context)
Write the configuration information for
Context
out to the specified configuration file. |
java.lang.String |
toString()
Return a String representation of this component.
|
getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregisteraddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stopprotected int utilityThreads
protected boolean utilityThreadsAsDaemon
protected int periodicEventDelay
public StandardServer()
public java.lang.Object getNamingToken()
getNamingToken in interface Serverpublic javax.naming.Context getGlobalNamingContext()
getGlobalNamingContext in interface Serverpublic void setGlobalNamingContext(javax.naming.Context globalNamingContext)
globalNamingContext - The new global naming resource contextpublic NamingResourcesImpl getGlobalNamingResources()
getGlobalNamingResources in interface Serverpublic void setGlobalNamingResources(NamingResourcesImpl globalNamingResources)
setGlobalNamingResources in interface ServerglobalNamingResources - The new global naming resourcespublic java.lang.String getServerInfo()
public java.lang.String getServerBuilt()
public java.lang.String getServerNumber()
public int getPort()
getPort in interface ServerServer.getPortOffset(),
Server.getPortWithOffset()public void setPort(int port)
setPort in interface Serverport - The new port numberServer.setPortOffset(int)public int getPortOffset()
ServergetPortOffset in interface Serverpublic void setPortOffset(int portOffset)
ServersetPortOffset in interface ServerportOffset - sets the port offsetpublic int getPortWithOffset()
ServergetPortWithOffset in interface Serverpublic java.lang.String getAddress()
getAddress in interface Serverpublic void setAddress(java.lang.String address)
setAddress in interface Serveraddress - The new addresspublic java.lang.String getShutdown()
getShutdown in interface Serverpublic void setShutdown(java.lang.String shutdown)
setShutdown in interface Servershutdown - The new shutdown commandpublic Catalina getCatalina()
getCatalina in interface Serverpublic void setCatalina(Catalina catalina)
setCatalina in interface Servercatalina - the outer Catalina componentpublic int getUtilityThreads()
ServergetUtilityThreads in interface Serverpublic void setUtilityThreads(int utilityThreads)
ServersetUtilityThreads in interface ServerutilityThreads - the new thread countpublic boolean getUtilityThreadsAsDaemon()
public void setUtilityThreadsAsDaemon(boolean utilityThreadsAsDaemon)
utilityThreadsAsDaemon - the new thread daemon flagpublic final int getPeriodicEventDelay()
public final void setPeriodicEventDelay(int periodicEventDelay)
periodicEventDelay - The period in seconds, negative or zero will
disable eventspublic void addService(Service service)
addService in interface Serverservice - The Service to be addedpublic void stopAwait()
public void await()
public Service findService(java.lang.String name)
ServerfindService in interface Servername - Name of the Service to be returnednull.public Service[] findServices()
findServices in interface Serverpublic javax.management.ObjectName[] getServiceNames()
public void removeService(Service service)
removeService in interface Serverservice - The Service to be removedpublic java.io.File getCatalinaBase()
getCatalinaBase in interface ServerServer.getCatalinaHome() will be used.public void setCatalinaBase(java.io.File catalinaBase)
ServersetCatalinaBase in interface ServercatalinaBase - the configured base directorypublic java.io.File getCatalinaHome()
getCatalinaHome in interface Serverpublic void setCatalinaHome(java.io.File catalinaHome)
ServersetCatalinaHome in interface ServercatalinaHome - the configured home directorypublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The listener to addpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The listener to removepublic java.lang.String toString()
toString in class java.lang.Objectpublic void storeConfig()
throws javax.management.InstanceNotFoundException,
javax.management.MBeanException
Server
out to the server.xml configuration file.javax.management.InstanceNotFoundException - if the managed resource object cannot be foundjavax.management.MBeanException - if the initializer of the object throws an exception, or
persistence is not supportedjavax.management.RuntimeOperationsException - if an exception is reported by the persistence mechanismpublic void storeContext(Context context) throws javax.management.InstanceNotFoundException, javax.management.MBeanException
Context
out to the specified configuration file.context - the context which should save its configurationjavax.management.InstanceNotFoundException - if the managed resource object cannot be foundjavax.management.MBeanException - if the initializer of the object throws an exception
or persistence is not supportedjavax.management.RuntimeOperationsException - if an exception is reported by the persistence mechanismprotected void startInternal()
throws LifecycleException
Services) and implement the requirements
of LifecycleBase.startInternal().startInternal in class LifecycleBaseLifecycleException - if this component detects a fatal error
that prevents this component from being usedprotected void startPeriodicLifecycleEvent()
protected void stopInternal()
throws LifecycleException
Services) and implement the requirements
of LifecycleBase.stopInternal().stopInternal in class LifecycleBaseLifecycleException - if this component detects a fatal error
that needs to be reportedprotected void initInternal()
throws LifecycleException
initInternal in class LifecycleMBeanBaseLifecycleException - If the initialisation failsprotected void destroyInternal()
throws LifecycleException
LifecycleMBeanBasedestroyInternal in class LifecycleMBeanBaseLifecycleException - If the destruction failspublic java.lang.ClassLoader getParentClassLoader()
getParentClassLoader in interface ServerServer.getCatalina() Catalina.getParentClassLoader(). If
catalina has not been set, return the system class loader.public void setParentClassLoader(java.lang.ClassLoader parent)
setParentClassLoader in interface Serverparent - The new parent class loaderprotected java.lang.String getDomainInternal()
getDomainInternal in class LifecycleMBeanBaseprotected final java.lang.String getObjectNameKeyProperties()
LifecycleMBeanBaseObjectName that will be used to register this component.getObjectNameKeyProperties in class LifecycleMBeanBaseObjectNamepublic java.util.concurrent.ScheduledExecutorService getUtilityExecutor()
getUtilityExecutor in interface ServerCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.