org.apache.catalina.core

Class StandardServer

public final class StandardServer extends Object implements Lifecycle, Server, MBeanRegistration

Standard implementation of the Server interface, available for use (but not required) when deploying and starting Catalina.

Version: $Revision: 762911 $ $Date: 2009-04-07 21:15:16 +0200 (Tue, 07 Apr 2009) $

Author: Craig R. McClanahan

Field Summary
protected Stringdomain
protected MBeanServermserver
protected ObjectNameoname
protected Stringsuffix
protected PropertyChangeSupportsupport
The property change support for this component.
protected Stringtype
Constructor Summary
StandardServer()
Construct a default instance of this class.
Method Summary
voidaddLifecycleListener(LifecycleListener listener)
Add a LifecycleEvent listener to this component.
voidaddPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
voidaddService(Service service)
Add a new Service to the set of defined Services.
voidawait()
Wait until a proper shutdown command is received, then return.
LifecycleListener[]findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle.
ServicefindService(String name)
Return the specified Service (if it exists); otherwise return null.
Service[]findServices()
Return the set of Services defined within this Server.
StringgetDomain()
ContextgetGlobalNamingContext()
Return the global naming resources context.
NamingResourcesgetGlobalNamingResources()
Return the global naming resources.
StringgetInfo()
Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.
ObjectNamegetObjectName()
intgetPort()
Return the port number we listen to for shutdown commands.
StringgetServerInfo()
Report the current Tomcat Server Release number
ObjectName[]getServiceNames()
Return the JMX service names.
StringgetShutdown()
Return the shutdown command string we are waiting for.
voidinit()
voidinitialize()
Invoke a pre-startup initialization.
voidpostDeregister()
voidpostRegister(Boolean registrationDone)
voidpreDeregister()
ObjectNamepreRegister(MBeanServer server, ObjectName name)
voidremoveLifecycleListener(LifecycleListener listener)
Remove a LifecycleEvent listener from this component.
voidremovePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
voidremoveService(Service service)
Remove the specified Service from the set associated from this Server.
voidsetGlobalNamingContext(Context globalNamingContext)
Set the global naming resources context.
voidsetGlobalNamingResources(NamingResources globalNamingResources)
Set the global naming resources.
voidsetPort(int port)
Set the port number we listen to for shutdown commands.
voidsetShutdown(String shutdown)
Set the shutdown command we are waiting for.
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.
voidstopAwait()
voidstoreConfig()
Write the configuration information for this entire Server out to the server.xml configuration file.
voidstoreContext(Context context)
Write the configuration information for Context out to the specified configuration file.
StringtoString()
Return a String representation of this component.

Field Detail

domain

protected String domain

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

Constructor Detail

StandardServer

public StandardServer()
Construct a default instance of this class.

Method Detail

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

addService

public void addService(Service service)
Add a new Service to the set of defined Services.

Parameters: service The Service to be added

await

public void await()
Wait until a proper shutdown command is received, then return. This keeps the main thread alive - the thread pool listening for http connections is daemon threads.

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.

findService

public Service findService(String name)
Return the specified Service (if it exists); otherwise return null.

Parameters: name Name of the Service to be returned

findServices

public Service[] findServices()
Return the set of Services defined within this Server.

getDomain

public String getDomain()

getGlobalNamingContext

public Context getGlobalNamingContext()
Return the global naming resources context.

getGlobalNamingResources

public NamingResources getGlobalNamingResources()
Return the global naming resources.

getInfo

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

getObjectName

public ObjectName getObjectName()

getPort

public int getPort()
Return the port number we listen to for shutdown commands.

getServerInfo

public String getServerInfo()
Report the current Tomcat Server Release number

Returns: Tomcat release identifier

getServiceNames

public ObjectName[] getServiceNames()
Return the JMX service names.

getShutdown

public String getShutdown()
Return the shutdown command string we are waiting for.

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)

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

removeService

public void removeService(Service service)
Remove the specified Service from the set associated from this Server.

Parameters: service The Service to be removed

setGlobalNamingContext

public void setGlobalNamingContext(Context globalNamingContext)
Set the global naming resources context.

Parameters: globalNamingContext The new global naming resource context

setGlobalNamingResources

public void setGlobalNamingResources(NamingResources globalNamingResources)
Set the global naming resources.

Parameters: globalNamingResources The new global naming resources

setPort

public void setPort(int port)
Set the port number we listen to for shutdown commands.

Parameters: port The new port number

setShutdown

public void setShutdown(String shutdown)
Set the shutdown command we are waiting for.

Parameters: shutdown The new shutdown command

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

stopAwait

public void stopAwait()

storeConfig

public void storeConfig()
Write the configuration information for this entire Server out to the server.xml configuration file.

Throws: javax.management.InstanceNotFoundException if the managed resource object cannot be found javax.management.MBeanException if the initializer of the object throws an exception, or persistence is not supported javax.management.RuntimeOperationsException if an exception is reported by the persistence mechanism

storeContext

public void storeContext(Context context)
Write the configuration information for Context out to the specified configuration file.

Throws: javax.management.InstanceNotFoundException if the managed resource object cannot be found javax.management.MBeanException if the initializer of the object throws an exception, or persistence is not supported javax.management.RuntimeOperationsException if an exception is reported by the persistence mechanism

toString

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