org.apache.catalina.core

Class StandardService

public class StandardService extends Object implements Lifecycle, Service, MBeanRegistration

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
protected Connector[]connectors
The set of Connectors associated with this Service.
protected Containercontainer
The Container associated with this Service.
protected ObjectNamecontroller
protected Stringdomain
protected ArrayList<Executor>executors
protected booleaninitialized
Has this component been initialized?
protected MBeanServermserver
protected ObjectNameoname
protected Stringsuffix
protected PropertyChangeSupportsupport
The property change support for this component.
protected Stringtype
Method Summary
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 service
voidaddLifecycleListener(LifecycleListener listener)
Add a LifecycleEvent listener to this component.
voidaddPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
voiddestroy()
Connector[]findConnectors()
Find and return the set of Connectors associated with this Service.
Executor[]findExecutors()
Retrieves all executors
LifecycleListener[]findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle.
ObjectName[]getConnectorNames()
ContainergetContainer()
Return the Container that handles requests for all Connectors associated with this Service.
ObjectNamegetContainerName()
StringgetDomain()
ExecutorgetExecutor(String name)
Retrieves executor by name, null if not found
StringgetInfo()
Return descriptive information about this Service implementation and the corresponding version number, in the format <description>/<version>.
StringgetName()
Return the name of this Service.
ObjectNamegetObjectName()
ServergetServer()
Return the Server with which we are associated (if any).
voidinit()
voidinitialize()
Invoke a pre-startup initialization.
voidpostDeregister()
voidpostRegister(Boolean registrationDone)
voidpreDeregister()
ObjectNamepreRegister(MBeanServer server, ObjectName name)
voidremoveConnector(Connector connector)
Remove the specified Connector from the set associated from this Service.
voidremoveExecutor(Executor ex)
Removes an executor from the service
voidremoveLifecycleListener(LifecycleListener listener)
Remove a LifecycleEvent listener from this component.
voidremovePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
voidsetContainer(Container container)
Set the Container that handles requests for all Connectors associated with this Service.
voidsetName(String name)
Set the name of this Service.
voidsetServer(Server server)
Set the Server with which we are associated (if any).
voidstart()
Prepare for the beginning of active use of the public methods of this component.
voidstop()
Gracefully terminate the active use of the public methods of this component.
StringtoString()
Return a String representation of this component.

Field Detail

connectors

protected Connector[] connectors
The set of Connectors associated with this Service.

container

protected Container container
The Container associated with this Service. (In the case of the org.apache.catalina.startup.Embedded subclass, this holds the most recently added Engine.)

controller

protected ObjectName controller

domain

protected String domain

executors

protected ArrayList<Executor> executors

initialized

protected boolean initialized
Has this component been initialized?

mserver

protected MBeanServer mserver

oname

protected ObjectName oname

suffix

protected String suffix

support

protected PropertyChangeSupport support
The property change support for this component.

type

protected String type

Method Detail

addConnector

public void addConnector(Connector connector)
Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.

Parameters: connector The Connector to be added

addExecutor

public void addExecutor(Executor ex)
Adds a named executor to the service

Parameters: ex Executor

addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a LifecycleEvent listener to this component.

Parameters: listener The listener to add

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.

Parameters: listener The listener to add

destroy

public void destroy()

findConnectors

public Connector[] findConnectors()
Find and return the set of Connectors associated with this Service.

findExecutors

public Executor[] findExecutors()
Retrieves all executors

Returns: Executor[]

findLifecycleListeners

public LifecycleListener[] findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

getConnectorNames

public ObjectName[] getConnectorNames()

getContainer

public Container getContainer()
Return the Container that handles requests for all Connectors associated with this Service.

getContainerName

public ObjectName getContainerName()

getDomain

public String getDomain()

getExecutor

public Executor getExecutor(String name)
Retrieves executor by name, null if not found

Parameters: name String

Returns: Executor

getInfo

public String getInfo()
Return descriptive information about this Service implementation and the corresponding version number, in the format <description>/<version>.

getName

public String getName()
Return the name of this Service.

getObjectName

public ObjectName getObjectName()

getServer

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

init

public void init()

initialize

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

postDeregister

public void postDeregister()

postRegister

public void postRegister(Boolean registrationDone)

preDeregister

public void preDeregister()

preRegister

public ObjectName preRegister(MBeanServer server, ObjectName name)

removeConnector

public 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.

Parameters: connector The Connector to be removed

removeExecutor

public void removeExecutor(Executor ex)
Removes an executor from the service

Parameters: ex Executor

removeLifecycleListener

public void removeLifecycleListener(LifecycleListener listener)
Remove a LifecycleEvent listener from this component.

Parameters: listener The listener to remove

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.

Parameters: listener The listener to remove

setContainer

public void setContainer(Container container)
Set the Container that handles requests for all Connectors associated with this Service.

Parameters: container The new Container

setName

public void setName(String name)
Set the name of this Service.

Parameters: name The new service name

setServer

public void setServer(Server server)
Set the Server with which we are associated (if any).

Parameters: server The server that owns this Service

start

public void start()
Prepare for the beginning of active use of the public methods of this component. This method should be called before any of the public methods of this component are utilized. It should also send a LifecycleEvent of type START_EVENT to any registered listeners.

Throws: LifecycleException if this component detects a fatal error that prevents this component from being used

stop

public void stop()
Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component. It should also send a LifecycleEvent of type STOP_EVENT to any registered listeners.

Throws: LifecycleException if this component detects a fatal error that needs to be reported

toString

public String toString()
Return a String representation of this component.
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.