Package org.apache.catalina.core
Class StandardService
- java.lang.Object
- 
- org.apache.catalina.util.LifecycleBase
- 
- org.apache.catalina.util.LifecycleMBeanBase
- 
- org.apache.catalina.core.StandardService
 
 
 
- 
- All Implemented Interfaces:
- javax.management.MBeanRegistration,- JmxEnabled,- Lifecycle,- Service
 
 public class StandardService extends LifecycleMBeanBase implements Service Standard implementation of theServiceinterface. The associated Container is generally an instance of Engine, but this is not required.- Author:
- Craig R. McClanahan
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected Connector[]connectorsThe set of Connectors associated with this Service.protected java.util.ArrayList<Executor>executorsThe list of executors held by the service.protected MappermapperMapper.protected MapperListenermapperListenerMapper listener.protected java.beans.PropertyChangeSupportsupportThe property change support for this component.- 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBasemserver
 - 
Fields inherited from interface org.apache.catalina.LifecycleAFTER_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 SummaryConstructors Constructor Description StandardService()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnector(Connector connector)Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.voidaddExecutor(Executor ex)Adds a named executor to the servicevoidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Add a property change listener to this component.protected voiddestroyInternal()Sub-classes wishing to perform additional clean-up should override this method, ensuring that super.destroyInternal() is the last call in the overriding method.Connector[]findConnectors()Find and return the set of Connectors associated with this Service.Executor[]findExecutors()Retrieves all executorsjavax.management.ObjectName[]getConnectorNames()EnginegetContainer()protected java.lang.StringgetDomainInternal()Method implemented by sub-classes to identify the domain in which MBeans should be registered.ExecutorgetExecutor(java.lang.String executorName)Retrieves executor by name, null if not foundlonggetGracefulStopAwaitMillis()MappergetMapper()java.lang.StringgetName()Return the name of this Service.java.lang.StringgetObjectNameKeyProperties()Allow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.java.lang.ClassLoadergetParentClassLoader()Return the parent class loader for this component.ServergetServer()Return theServerwith which we are associated (if any).protected voidinitInternal()Invoke a pre-startup initialization.voidremoveConnector(Connector connector)Remove the specified Connector from the set associated from this Service.voidremoveExecutor(Executor ex)Removes an executor from the servicevoidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Remove a property change listener from this component.voidsetContainer(Engine engine)Set theEnginethat handles requests for allConnectorsassociated with this Service.voidsetGracefulStopAwaitMillis(long gracefulStopAwaitMillis)voidsetName(java.lang.String name)Set the name of this Service.voidsetParentClassLoader(java.lang.ClassLoader parent)Set the parent class loader for this server.voidsetServer(Server server)Set theServerwith which we are associated (if any).protected voidstartInternal()Start nested components (Executors,Connectors andContainers) and implement the requirements ofLifecycleBase.startInternal().protected voidstopInternal()Stop nested components (Executors,Connectors andContainers) and implement the requirements ofLifecycleBase.stopInternal().java.lang.StringtoString()Return a String representation of this component.- 
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBasegetDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
 - 
Methods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.catalina.LifecycleaddLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
 
- 
 
- 
- 
- 
Field Detail- 
supportprotected final java.beans.PropertyChangeSupport support The property change support for this component.
 - 
connectorsprotected Connector[] connectors The set of Connectors associated with this Service.
 - 
executorsprotected final java.util.ArrayList<Executor> executors The list of executors held by the service.
 - 
mapperprotected final Mapper mapper Mapper.
 - 
mapperListenerprotected final MapperListener mapperListener Mapper listener.
 
- 
 - 
Method Detail- 
getGracefulStopAwaitMillispublic long getGracefulStopAwaitMillis() 
 - 
setGracefulStopAwaitMillispublic void setGracefulStopAwaitMillis(long gracefulStopAwaitMillis) 
 - 
getMapperpublic Mapper getMapper() 
 - 
getContainerpublic Engine getContainer() - Specified by:
- getContainerin interface- Service
- Returns:
- the Enginethat handles requests for allConnectorsassociated with this Service.
 
 - 
setContainerpublic void setContainer(Engine engine) Description copied from interface:ServiceSet theEnginethat handles requests for allConnectorsassociated with this Service.- Specified by:
- setContainerin interface- Service
- Parameters:
- engine- The new Engine
 
 - 
getNamepublic java.lang.String getName() Return the name of this Service.
 - 
setNamepublic void setName(java.lang.String name) Set the name of this Service.
 - 
getServerpublic Server getServer() Return theServerwith which we are associated (if any).
 - 
setServerpublic void setServer(Server server) Set theServerwith which we are associated (if any).
 - 
addConnectorpublic void addConnector(Connector connector) Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.- Specified by:
- addConnectorin interface- Service
- Parameters:
- connector- The Connector to be added
 
 - 
getConnectorNamespublic javax.management.ObjectName[] getConnectorNames() 
 - 
addPropertyChangeListenerpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener) Add a property change listener to this component.- Parameters:
- listener- The listener to add
 
 - 
findConnectorspublic Connector[] findConnectors() Find and return the set of Connectors associated with this Service.- Specified by:
- findConnectorsin interface- Service
- Returns:
- the set of associated Connectors
 
 - 
removeConnectorpublic void removeConnector(Connector connector) Remove the specified Connector from the set associated from this Service. The removed Connector will also be disassociated from our Container.- Specified by:
- removeConnectorin interface- Service
- Parameters:
- connector- The Connector to be removed
 
 - 
removePropertyChangeListenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener) Remove a property change listener from this component.- Parameters:
- listener- The listener to remove
 
 - 
toStringpublic java.lang.String toString() Return a String representation of this component.- Overrides:
- toStringin class- java.lang.Object
 
 - 
addExecutorpublic void addExecutor(Executor ex) Adds a named executor to the service- Specified by:
- addExecutorin interface- Service
- Parameters:
- ex- Executor
 
 - 
findExecutorspublic Executor[] findExecutors() Retrieves all executors- Specified by:
- findExecutorsin interface- Service
- Returns:
- Executor[]
 
 - 
getExecutorpublic Executor getExecutor(java.lang.String executorName) Retrieves executor by name, null if not found- Specified by:
- getExecutorin interface- Service
- Parameters:
- executorName- String
- Returns:
- Executor
 
 - 
removeExecutorpublic void removeExecutor(Executor ex) Removes an executor from the service- Specified by:
- removeExecutorin interface- Service
- Parameters:
- ex- Executor
 
 - 
startInternalprotected void startInternal() throws LifecycleExceptionStart nested components (Executors,Connectors andContainers) and implement the requirements ofLifecycleBase.startInternal().- Specified by:
- startInternalin class- LifecycleBase
- Throws:
- LifecycleException- if this component detects a fatal error that prevents this component from being used
 
 - 
stopInternalprotected void stopInternal() throws LifecycleExceptionStop nested components (Executors,Connectors andContainers) and implement the requirements ofLifecycleBase.stopInternal().- Specified by:
- stopInternalin class- LifecycleBase
- Throws:
- LifecycleException- if this component detects a fatal error that needs to be reported
 
 - 
initInternalprotected void initInternal() throws LifecycleExceptionInvoke a pre-startup initialization. This is used to allow connectors to bind to restricted ports under Unix operating environments.- Overrides:
- initInternalin class- LifecycleMBeanBase
- Throws:
- LifecycleException- If the initialisation fails
 
 - 
destroyInternalprotected void destroyInternal() throws LifecycleExceptionDescription copied from class:LifecycleMBeanBaseSub-classes wishing to perform additional clean-up should override this method, ensuring that super.destroyInternal() is the last call in the overriding method.- Overrides:
- destroyInternalin class- LifecycleMBeanBase
- Throws:
- LifecycleException- If the destruction fails
 
 - 
getParentClassLoaderpublic java.lang.ClassLoader getParentClassLoader() Return the parent class loader for this component.- Specified by:
- getParentClassLoaderin interface- Service
- Returns:
- the parent class loader for this component. If not set, return
 Service.getServer()Server.getParentClassLoader(). If no server has been set, return the system class loader.
 
 - 
setParentClassLoaderpublic void setParentClassLoader(java.lang.ClassLoader parent) Set the parent class loader for this server.- Specified by:
- setParentClassLoaderin interface- Service
- Parameters:
- parent- The new parent class loader
 
 - 
getDomainInternalprotected java.lang.String getDomainInternal() Description copied from class:LifecycleMBeanBaseMethod implemented by sub-classes to identify the domain in which MBeans should be registered.- Specified by:
- getDomainInternalin class- LifecycleMBeanBase
- Returns:
- The name of the domain to use to register MBeans.
 
 - 
getObjectNameKeyPropertiespublic final java.lang.String getObjectNameKeyProperties() Description copied from class:LifecycleMBeanBaseAllow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.- Specified by:
- getObjectNameKeyPropertiesin class- LifecycleMBeanBase
- Returns:
- The string representation of the key properties component of the
          desired ObjectName
 
 
- 
 
-