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:
MBeanRegistration
,JmxEnabled
,Lifecycle
,Service
Standard implementation of the
Service
interface. 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.Lifecycle
Lifecycle.SingleUse
-
Field Summary
Modifier and TypeFieldDescriptionprotected Connector[]
The set of Connectors associated with this Service.The list of executors held by the service.protected final Mapper
Mapper.protected final MapperListener
Mapper listener.protected final PropertyChangeSupport
The property change support for this component.Fields inherited from interface org.apache.catalina.Lifecycle
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConnector
(Connector connector) Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.void
addExecutor
(Executor ex) Adds a named executor to the servicevoid
Add a property change listener to this component.protected void
Sub-classes implement this method to perform any instance destruction required.Find and return the set of Connectors associated with this Service.Executor[]
Retrieves all executorsprotected String
Method implemented by sub-classes to identify the domain in which MBeans should be registered.getExecutor
(String executorName) Retrieves executor by name, null if not foundlong
getName()
final String
Allow sub-classes to specify the key properties component of theObjectName
that will be used to register this component.protected void
Invoke a pre-startup initialization.void
removeConnector
(Connector connector) Remove the specified Connector from the set associated from this Service.void
Removes an executor from the servicevoid
Remove a property change listener from this component.void
setContainer
(Engine engine) Set theEngine
that handles requests for allConnectors
associated with this Service.void
setGracefulStopAwaitMillis
(long gracefulStopAwaitMillis) void
Set the name of this Service.void
setParentClassLoader
(ClassLoader parent) Set the parent class loader for this service.void
Set theServer
with which we are associated (if any).protected void
Start nested components (Executor
s,Connector
s andContainer
s) and implement the requirements ofLifecycleBase.startInternal()
.protected void
Stop nested components (Executor
s,Connector
s andContainer
s) and implement the requirements ofLifecycleBase.stopInternal()
.toString()
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.catalina.Lifecycle
addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
-
Field Details
-
support
The property change support for this component. -
connectors
The set of Connectors associated with this Service. -
executors
-
mapper
Mapper. -
mapperListener
Mapper listener.
-
-
Constructor Details
-
StandardService
public StandardService()
-
-
Method Details
-
getGracefulStopAwaitMillis
public long getGracefulStopAwaitMillis() -
setGracefulStopAwaitMillis
public void setGracefulStopAwaitMillis(long gracefulStopAwaitMillis) -
getMapper
-
getContainer
- Specified by:
getContainer
in interfaceService
- Returns:
- the
Engine
that handles requests for allConnectors
associated with this Service.
-
setContainer
Description copied from interface:Service
Set theEngine
that handles requests for allConnectors
associated with this Service.- Specified by:
setContainer
in interfaceService
- Parameters:
engine
- The new Engine
-
getName
-
setName
-
getServer
-
setServer
-
addConnector
Description copied from interface:Service
Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.- Specified by:
addConnector
in interfaceService
- Parameters:
connector
- The Connector to be added
-
getConnectorNames
-
addPropertyChangeListener
Add a property change listener to this component.- Parameters:
listener
- The listener to add
-
findConnectors
Description copied from interface:Service
Find and return the set of Connectors associated with this Service.- Specified by:
findConnectors
in interfaceService
- Returns:
- the set of associated Connectors
-
removeConnector
Description copied from interface:Service
Remove the specified Connector from the set associated from this Service. The removed Connector will also be disassociated from our Container.- Specified by:
removeConnector
in interfaceService
- Parameters:
connector
- The Connector to be removed
-
removePropertyChangeListener
Remove a property change listener from this component.- Parameters:
listener
- The listener to remove
-
toString
-
addExecutor
Description copied from interface:Service
Adds a named executor to the service- Specified by:
addExecutor
in interfaceService
- Parameters:
ex
- Executor
-
findExecutors
Description copied from interface:Service
Retrieves all executors- Specified by:
findExecutors
in interfaceService
- Returns:
- Executor[]
-
getExecutor
Description copied from interface:Service
Retrieves executor by name, null if not found- Specified by:
getExecutor
in interfaceService
- Parameters:
executorName
- String- Returns:
- Executor
-
removeExecutor
Description copied from interface:Service
Removes an executor from the service- Specified by:
removeExecutor
in interfaceService
- Parameters:
ex
- Executor
-
startInternal
Start nested components (Executor
s,Connector
s andContainer
s) and implement the requirements ofLifecycleBase.startInternal()
.- Specified by:
startInternal
in classLifecycleBase
- Throws:
LifecycleException
- if this component detects a fatal error that prevents this component from being used
-
stopInternal
Stop nested components (Executor
s,Connector
s andContainer
s) and implement the requirements ofLifecycleBase.stopInternal()
.- Specified by:
stopInternal
in classLifecycleBase
- Throws:
LifecycleException
- if this component detects a fatal error that needs to be reported
-
initInternal
Invoke a pre-startup initialization. This is used to allow connectors to bind to restricted ports under Unix operating environments.- Overrides:
initInternal
in classLifecycleMBeanBase
- Throws:
LifecycleException
- if this component detects a fatal error that needs to be reported
-
destroyInternal
Description copied from class:LifecycleBase
Sub-classes implement this method to perform any instance destruction required.- Overrides:
destroyInternal
in classLifecycleMBeanBase
- Throws:
LifecycleException
- If the destruction fails
-
getParentClassLoader
- Specified by:
getParentClassLoader
in interfaceService
- 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.
-
setParentClassLoader
Description copied from interface:Service
Set the parent class loader for this service.- Specified by:
setParentClassLoader
in interfaceService
- Parameters:
parent
- The new parent class loader
-
getDomainInternal
Description copied from class:LifecycleMBeanBase
Method implemented by sub-classes to identify the domain in which MBeans should be registered.- Specified by:
getDomainInternal
in classLifecycleMBeanBase
- Returns:
- The name of the domain to use to register MBeans.
-
getObjectNameKeyProperties
Description copied from class:LifecycleMBeanBase
Allow sub-classes to specify the key properties component of theObjectName
that will be used to register this component.- Specified by:
getObjectNameKeyProperties
in classLifecycleMBeanBase
- Returns:
- The string representation of the key properties component of the desired
ObjectName
-