Top Description Fields Methods
org.apache.catalina

public Interface Server

extends Lifecycle
Known Direct Implementers
org.apache.catalina.core.StandardServer
Imports
java.io.File, java.util.concurrent.ScheduledExecutorService, org.apache.catalina.deploy.NamingResourcesImpl, org.apache.catalina.startup.Catalina

A Server element represents the entire Catalina servlet container. Its attributes represent the characteristics of the servlet container as a whole. A Server may contain one or more Services, and the top level set of naming resources.

Normally, an implementation of this interface will also implement Lifecycle, such that when the start() and stop() methods are called, all of the defined Services are also started or stopped.

In between, the implementation must open a server socket on the port number specified by the port property. When a connection is accepted, the first line is read and compared with the specified shutdown command. If the command matches, shutdown of the server is initiated.

Author
Craig R. McClanahan

Field Summary

Inherited from org.apache.catalina.Lifecycle:
AFTER_DESTROY_EVENTAFTER_INIT_EVENTAFTER_START_EVENTAFTER_STOP_EVENTBEFORE_DESTROY_EVENTBEFORE_INIT_EVENTBEFORE_START_EVENTBEFORE_STOP_EVENTCONFIGURE_START_EVENTCONFIGURE_STOP_EVENTPERIODIC_EVENTSTART_EVENTSTOP_EVENT

Method Summary

Modifier and TypeMethod and Description
public void
addService(Service
The Service to be added
service
)

Add a new Service to the set of defined Services.

public void
await()

Wait until a proper shutdown command is received, then return.

public Service

Returns:

the specified Service, or null if none exists.
findService
(String
Name of the Service to be returned
name
)

Find the specified Service

public Service[]

Returns:

the set of Services defined within this Server.
findServices
()

public String

Returns:

the address on which we listen to for shutdown commands.
getAddress
()

public Catalina

Returns:

the outer Catalina startup/shutdown component if present.
getCatalina
()

public File

Returns:

the configured base (instance) directory. Note that home and base may be the same (and are by default). If this is not set the value returned by getCatalinaHome() will be used.
getCatalinaBase
()

public File

Returns:

the configured home (binary) directory. Note that home and base may be the same (and are by default).
getCatalinaHome
()

public Context

Returns:

the global naming resources context.
getGlobalNamingContext
()

public NamingResourcesImpl

Returns:

the global naming resources.
getGlobalNamingResources
()

public Object

Returns:

the token necessary for operations on the associated JNDI naming context.
getNamingToken
()

public ClassLoader

Returns:

the parent class loader for this component. If not set, return getCatalina() Catalina#getParentClassLoader(). If catalina has not been set, return the system class loader.
getParentClassLoader
()

public int

Returns:

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

public int

Returns:

the port offset
getPortOffset
()

Get the number that offsets the port used for shutdown commands.

public int

Returns:

the port with offset
getPortWithOffset
()

Get the actual port on which server is listening for the shutdown commands.

public String

Returns:

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

public ScheduledExecutorService

Returns:

the utility executor managed by the Service.
getUtilityExecutor
()

public int

Returns:

the thread count
getUtilityThreads
()

Get the utility thread count.

public void
removeService(Service
The Service to be removed
service
)

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

public void
setAddress(String
The new address
address
)

Set the address on which we listen to for shutdown commands.

public void
setCatalina(Catalina
the outer Catalina component
catalina
)

Set the outer Catalina startup/shutdown component if present.

public void
setCatalinaBase(File
the configured base directory
catalinaBase
)

Set the configured base (instance) directory.

public void
setCatalinaHome(File
the configured home directory
catalinaHome
)

Set the configured home (binary) directory.

public void
setGlobalNamingResources(NamingResourcesImpl
The new global naming resources
globalNamingResources
)

Set the global naming resources.

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

Set the parent class loader for this server.

public void
setPort(int
The new port number
port
)

Set the port number we listen to for shutdown commands.

public void
setPortOffset(int
sets the port offset
portOffset
)

Set the number that offsets the server port used for shutdown commands.

public void
setShutdown(String
The new shutdown command
shutdown
)

Set the shutdown command we are waiting for.

public void
setUtilityThreads(int
the new thread count
utilityThreads
)

Set the utility thread count.

Inherited from org.apache.catalina.Lifecycle:
addLifecycleListenerdestroyfindLifecycleListenersgetStategetStateNameinitremoveLifecycleListenerstartstop

Method Detail

addServiceback to summary
public void addService(Service service)

Add a new Service to the set of defined Services.

Parameters
service:Service

The Service to be added

awaitback to summary
public void await()

Wait until a proper shutdown command is received, then return.

findServiceback to summary
public Service findService(String name)

Find the specified Service

Parameters
name:String

Name of the Service to be returned

Returns:Service

the specified Service, or null if none exists.

findServicesback to summary
public Service[] findServices()
Returns:Service[]

the set of Services defined within this Server.

getAddressback to summary
public String getAddress()
Returns:String

the address on which we listen to for shutdown commands.

getCatalinaback to summary
public Catalina getCatalina()
Returns:Catalina

the outer Catalina startup/shutdown component if present.

getCatalinaBaseback to summary
public File getCatalinaBase()
Returns:File

the configured base (instance) directory. Note that home and base may be the same (and are by default). If this is not set the value returned by getCatalinaHome() will be used.

getCatalinaHomeback to summary
public File getCatalinaHome()
Returns:File

the configured home (binary) directory. Note that home and base may be the same (and are by default).

getGlobalNamingContextback to summary
public Context getGlobalNamingContext()
Returns:Context

the global naming resources context.

getGlobalNamingResourcesback to summary
public NamingResourcesImpl getGlobalNamingResources()
Returns:NamingResourcesImpl

the global naming resources.

getNamingTokenback to summary
public Object getNamingToken()
Returns:Object

the token necessary for operations on the associated JNDI naming context.

getParentClassLoaderback to summary
public ClassLoader getParentClassLoader()
Returns:ClassLoader

the parent class loader for this component. If not set, return getCatalina() Catalina#getParentClassLoader(). If catalina has not been set, return the system class loader.

getPortback to summary
public int getPort()
Returns:int

the port number we listen to for shutdown commands.

See Also
getPortOffset(), getPortWithOffset()
getPortOffsetback to summary
public int getPortOffset()

Get the number that offsets the port used for shutdown commands. For example, if port is 8005, and portOffset is 1000, the server listens at 9005.

Returns:int

the port offset

getPortWithOffsetback to summary
public int getPortWithOffset()

Get the actual port on which server is listening for the shutdown commands. If you do not set port offset, port is returned. If you set port offset, port offset + port is returned.

Returns:int

the port with offset

getShutdownback to summary
public String getShutdown()
Returns:String

the shutdown command string we are waiting for.

getUtilityExecutorback to summary
public ScheduledExecutorService getUtilityExecutor()
Returns:ScheduledExecutorService

the utility executor managed by the Service.

getUtilityThreadsback to summary
public int getUtilityThreads()

Get the utility thread count.

Returns:int

the thread count

removeServiceback to summary
public void removeService(Service service)

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

Parameters
service:Service

The Service to be removed

setAddressback to summary
public void setAddress(String address)

Set the address on which we listen to for shutdown commands.

Parameters
address:String

The new address

setCatalinaback to summary
public void setCatalina(Catalina catalina)

Set the outer Catalina startup/shutdown component if present.

Parameters
catalina:Catalina

the outer Catalina component

setCatalinaBaseback to summary
public void setCatalinaBase(File catalinaBase)

Set the configured base (instance) directory. Note that home and base may be the same (and are by default).

Parameters
catalinaBase:File

the configured base directory

setCatalinaHomeback to summary
public void setCatalinaHome(File catalinaHome)

Set the configured home (binary) directory. Note that home and base may be the same (and are by default).

Parameters
catalinaHome:File

the configured home directory

setGlobalNamingResourcesback to summary
public void setGlobalNamingResources(NamingResourcesImpl globalNamingResources)

Set the global naming resources.

Parameters
globalNamingResources:NamingResourcesImpl

The new global naming resources

setParentClassLoaderback to summary
public void setParentClassLoader(ClassLoader parent)

Set the parent class loader for this server.

Parameters
parent:ClassLoader

The new parent class loader

setPortback to summary
public void setPort(int port)

Set the port number we listen to for shutdown commands.

Parameters
port:int

The new port number

See Also
setPortOffset(int)
setPortOffsetback to summary
public void setPortOffset(int portOffset)

Set the number that offsets the server port used for shutdown commands. For example, if port is 8005, and you set portOffset to 1000, connector listens at 9005.

Parameters
portOffset:int

sets the port offset

setShutdownback to summary
public void setShutdown(String shutdown)

Set the shutdown command we are waiting for.

Parameters
shutdown:String

The new shutdown command

setUtilityThreadsback to summary
public void setUtilityThreads(int utilityThreads)

Set the utility thread count.

Parameters
utilityThreads:int

the new thread count