Top Description Fields Constructors Methods
org.apache.catalina.core

public Class StandardService

extends LifecycleMBeanBase
implements Service
Class Inheritance
All Implemented Interfaces
org.apache.catalina.Service, org.apache.catalina.Lifecycle
Imports
java.beans.PropertyChangeListener, .PropertyChangeSupport, java.util.ArrayList, javax.management.ObjectName, org.apache.catalina.Container, .Engine, .Executor, .JmxEnabled, .LifecycleException, .LifecycleState, .Server, .Service, org.apache.catalina.connector.Connector, org.apache.catalina.mapper.Mapper, .MapperListener, org.apache.catalina.util.LifecycleMBeanBase, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.res.StringManager

Standard implementation of the Service interface. The associated Container is generally an instance of Engine, but this is not required.
Author
Craig R. McClanahan

Field Summary

Modifier and TypeField and Description
protected Connector[]
connectors

The set of Connectors associated with this Service.

private final Object
private Engine
protected final ArrayList<Executor>
executors

The list of executors held by the service.

private long
private static final Log
protected final Mapper
mapper

Mapper.

protected final MapperListener
mapperListener

Mapper listener.

private String
name

The name of this service.

private ClassLoader
private Server
server

The Server that owns this Service, if any.

private static final StringManager
protected final PropertyChangeSupport
support

The property change support for this component.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addConnector(Connector
The Connector to be added
connector
)

Implements org.apache.catalina.Service.addConnector.

Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.

public void
addExecutor(Executor
Executor
ex
)

Implements org.apache.catalina.Service.addExecutor.

Adds a named executor to the service

public void
addPropertyChangeListener(PropertyChangeListener
The listener to add
listener
)

Add a property change listener to this component.

protected void
destroyInternal()

Overrides org.apache.catalina.util.LifecycleMBeanBase.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.

public Connector[]
findConnectors()

Implements org.apache.catalina.Service.findConnectors.

Find and return the set of Connectors associated with this Service.

public Executor[]

Returns:

Executor[]
findExecutors
()

Implements org.apache.catalina.Service.findExecutors.

Retrieves all executors

public ObjectName[]
public Engine
protected String
getDomainInternal()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getDomainInternal.

Method implemented by sub-classes to identify the domain in which MBeans should be registered.

public Executor

Returns:

Executor
getExecutor
(String
String
executorName
)

Implements org.apache.catalina.Service.getExecutor.

Retrieves executor by name, null if not found

public long
public Mapper
public String
getName()

Implements org.apache.catalina.Service.getName.

Return the name of this Service.

public final String
getObjectNameKeyProperties()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.

public ClassLoader
getParentClassLoader()

Implements org.apache.catalina.Service.getParentClassLoader.

Return the parent class loader for this component.

public Server
getServer()

Implements org.apache.catalina.Service.getServer.

Return the Server with which we are associated (if any).

protected void
initInternal()

Overrides org.apache.catalina.util.LifecycleMBeanBase.initInternal.

Invoke a pre-startup initialization.

public void
removeConnector(Connector
The Connector to be removed
connector
)

Implements org.apache.catalina.Service.removeConnector.

Remove the specified Connector from the set associated from this Service.

public void
removeExecutor(Executor
Executor
ex
)

Implements org.apache.catalina.Service.removeExecutor.

Removes an executor from the service

public void
removePropertyChangeListener(PropertyChangeListener
The listener to remove
listener
)

Remove a property change listener from this component.

public void
setContainer(Engine
The new Engine
engine
)

Implements org.apache.catalina.Service.setContainer.

Set the Engine that handles requests for all Connectors associated with this Service.

public void
setGracefulStopAwaitMillis(long gracefulStopAwaitMillis)

public void
setName(String
The new service name
name
)

Implements org.apache.catalina.Service.setName.

Set the name of this Service.

public void
setParentClassLoader(ClassLoader
The new parent class loader
parent
)

Implements org.apache.catalina.Service.setParentClassLoader.

Set the parent class loader for this server.

public void
setServer(Server
The server that owns this Service
server
)

Implements org.apache.catalina.Service.setServer.

Set the Server with which we are associated (if any).

protected void
startInternal()

Implements abstract org.apache.catalina.util.LifecycleBase.startInternal.

Start nested components (Executors, Connectors and Containers) and implement the requirements of org.apache.catalina.util.LifecycleBase#startInternal().

protected void
stopInternal()

Implements abstract org.apache.catalina.util.LifecycleBase.stopInternal.

Stop nested components (Executors, Connectors and Containers) and implement the requirements of org.apache.catalina.util.LifecycleBase#stopInternal().

public String
toString()

Overrides java.lang.Object.toString.

Return a String representation of this component.

Inherited from org.apache.catalina.util.LifecycleMBeanBase:
getDomaingetObjectNamepostDeregisterpostRegisterpreDeregisterpreRegisterregistersetDomainunregisterunregister

Field Detail

connectorsback to summary
protected Connector[] connectors

The set of Connectors associated with this Service.

connectorsLockback to summary
private final Object connectorsLock
engineback to summary
private Engine engine
executorsback to summary
protected final ArrayList<Executor> executors

The list of executors held by the service.

gracefulStopAwaitMillisback to summary
private long gracefulStopAwaitMillis
logback to summary
private static final Log log

Hides org.apache.catalina.util.LifecycleMBeanBase.log.

mapperback to summary
protected final Mapper mapper

Mapper.

mapperListenerback to summary
protected final MapperListener mapperListener

Mapper listener.

nameback to summary
private String name

The name of this service.

parentClassLoaderback to summary
private ClassLoader parentClassLoader
serverback to summary
private Server server

The Server that owns this Service, if any.

smback to summary
private static final StringManager sm

Hides org.apache.catalina.util.LifecycleMBeanBase.sm.

supportback to summary
protected final PropertyChangeSupport support

The property change support for this component.

Constructor Detail

StandardServiceback to summary
public StandardService()

Method Detail

addConnectorback to summary
public void addConnector(Connector connector)

Implements org.apache.catalina.Service.addConnector.

Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.

Parameters
connector:Connector

The Connector to be added

Annotations
@Override
addExecutorback to summary
public void addExecutor(Executor ex)

Implements org.apache.catalina.Service.addExecutor.

Adds a named executor to the service

Parameters
ex:Executor

Executor

Annotations
@Override
addPropertyChangeListenerback to summary
public void addPropertyChangeListener(PropertyChangeListener listener)

Add a property change listener to this component.

Parameters
listener:PropertyChangeListener

The listener to add

destroyInternalback to summary
protected void destroyInternal() throws LifecycleException

Overrides org.apache.catalina.util.LifecycleMBeanBase.destroyInternal.

Doc from org.apache.catalina.util.LifecycleMBeanBase.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.

Annotations
@Override
Exceptions
LifecycleException:

Doc from org.apache.catalina.util.LifecycleBase.destroyInternal.

If the destruction fails

findConnectorsback to summary
public Connector[] findConnectors()

Implements org.apache.catalina.Service.findConnectors.

Find and return the set of Connectors associated with this Service.

Returns:Connector[]

Doc from org.apache.catalina.Service.findConnectors.

the set of associated Connectors

Annotations
@Override
findExecutorsback to summary
public Executor[] findExecutors()

Implements org.apache.catalina.Service.findExecutors.

Retrieves all executors

Returns:Executor[]

Executor[]

Annotations
@Override
getConnectorNamesback to summary
public ObjectName[] getConnectorNames()
getContainerback to summary
public Engine getContainer()

Implements org.apache.catalina.Service.getContainer.

Returns:Engine

Doc from org.apache.catalina.Service.getContainer.

the Engine that handles requests for all Connectors associated with this Service.

Annotations
@Override
getDomainInternalback to summary
protected String getDomainInternal()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getDomainInternal.

Doc from org.apache.catalina.util.LifecycleMBeanBase.getDomainInternal.

Method implemented by sub-classes to identify the domain in which MBeans should be registered.

Returns:String

The name of the domain to use to register MBeans.

Annotations
@Override
getExecutorback to summary
public Executor getExecutor(String executorName)

Implements org.apache.catalina.Service.getExecutor.

Retrieves executor by name, null if not found

Parameters
executorName:String

String

Returns:Executor

Executor

Annotations
@Override
getGracefulStopAwaitMillisback to summary
public long getGracefulStopAwaitMillis()
getMapperback to summary
public Mapper getMapper()

Implements org.apache.catalina.Service.getMapper.

Returns:Mapper

Doc from org.apache.catalina.Service.getMapper.

the mapper associated with this Service.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.apache.catalina.Service.getName.

Return the name of this Service.

Returns:String

Doc from org.apache.catalina.Service.getName.

the name of this Service.

Annotations
@Override
getObjectNameKeyPropertiesback to summary
public final String getObjectNameKeyProperties()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Doc from org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.

Returns:String

The string representation of the key properties component of the desired ObjectName

Annotations
@Override
getParentClassLoaderback to summary
public ClassLoader getParentClassLoader()

Implements org.apache.catalina.Service.getParentClassLoader.

Return the parent class loader for this component.

Returns:ClassLoader

Doc from org.apache.catalina.Service.getParentClassLoader.

the parent class loader for this component. If not set, return getServer() Server#getParentClassLoader(). If no server has been set, return the system class loader.

Annotations
@Override
getServerback to summary
public Server getServer()

Implements org.apache.catalina.Service.getServer.

Return the Server with which we are associated (if any).

Returns:Server

Doc from org.apache.catalina.Service.getServer.

the Server with which we are associated (if any).

Annotations
@Override
initInternalback to summary
protected void initInternal() throws LifecycleException

Overrides org.apache.catalina.util.LifecycleMBeanBase.initInternal.

Invoke a pre-startup initialization. This is used to allow connectors to bind to restricted ports under Unix operating environments.

Annotations
@Override
Exceptions
LifecycleException:

Doc from org.apache.catalina.util.LifecycleBase.initInternal.

If the initialisation fails

removeConnectorback to summary
public void removeConnector(Connector connector)

Implements org.apache.catalina.Service.removeConnector.

Remove the specified Connector from the set associated from this Service. The removed Connector will also be disassociated from our Container.

Parameters
connector:Connector

The Connector to be removed

Annotations
@Override
removeExecutorback to summary
public void removeExecutor(Executor ex)

Implements org.apache.catalina.Service.removeExecutor.

Removes an executor from the service

Parameters
ex:Executor

Executor

Annotations
@Override
removePropertyChangeListenerback to summary
public void removePropertyChangeListener(PropertyChangeListener listener)

Remove a property change listener from this component.

Parameters
listener:PropertyChangeListener

The listener to remove

setContainerback to summary
public void setContainer(Engine engine)

Implements org.apache.catalina.Service.setContainer.

Doc from org.apache.catalina.Service.setContainer.

Set the Engine that handles requests for all Connectors associated with this Service.

Parameters
engine:Engine

The new Engine

Annotations
@Override
setGracefulStopAwaitMillisback to summary
public void setGracefulStopAwaitMillis(long gracefulStopAwaitMillis)
setNameback to summary
public void setName(String name)

Implements org.apache.catalina.Service.setName.

Set the name of this Service.

Parameters
name:String

The new service name

Annotations
@Override
setParentClassLoaderback to summary
public void setParentClassLoader(ClassLoader parent)

Implements org.apache.catalina.Service.setParentClassLoader.

Set the parent class loader for this server.

Parameters
parent:ClassLoader

The new parent class loader

Annotations
@Override
setServerback to summary
public void setServer(Server server)

Implements org.apache.catalina.Service.setServer.

Set the Server with which we are associated (if any).

Parameters
server:Server

The server that owns this Service

Annotations
@Override
startInternalback to summary
protected void startInternal() throws LifecycleException

Implements abstract org.apache.catalina.util.LifecycleBase.startInternal.

Start nested components (Executors, Connectors and Containers) and implement the requirements of org.apache.catalina.util.LifecycleBase#startInternal().

Annotations
@Override
Exceptions
LifecycleException:
if this component detects a fatal error that prevents this component from being used
stopInternalback to summary
protected void stopInternal() throws LifecycleException

Implements abstract org.apache.catalina.util.LifecycleBase.stopInternal.

Stop nested components (Executors, Connectors and Containers) and implement the requirements of org.apache.catalina.util.LifecycleBase#stopInternal().

Annotations
@Override
Exceptions
LifecycleException:
if this component detects a fatal error that needs to be reported
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Return a String representation of this component.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

Annotations
@Override