Interface Server

  • All Superinterfaces:
    Lifecycle
    All Known Implementing Classes:
    StandardServer

    public interface Server
    extends Lifecycle
    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
    • Method Detail

      • getGlobalNamingResources

        NamingResourcesImpl getGlobalNamingResources()
        Returns:
        the global naming resources.
      • setGlobalNamingResources

        void setGlobalNamingResources​(NamingResourcesImpl globalNamingResources)
        Set the global naming resources.
        Parameters:
        globalNamingResources - The new global naming resources
      • getGlobalNamingContext

        javax.naming.Context getGlobalNamingContext()
        Returns:
        the global naming resources context.
      • setPort

        void setPort​(int port)
        Set the port number we listen to for shutdown commands.
        Parameters:
        port - The new port number
        See Also:
        setPortOffset(int)
      • getPortOffset

        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:
        the port offset
      • setPortOffset

        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 - sets the port offset
      • getPortWithOffset

        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:
        the port with offset
      • getAddress

        java.lang.String getAddress()
        Returns:
        the address on which we listen to for shutdown commands.
      • setAddress

        void setAddress​(java.lang.String address)
        Set the address on which we listen to for shutdown commands.
        Parameters:
        address - The new address
      • getShutdown

        java.lang.String getShutdown()
        Returns:
        the shutdown command string we are waiting for.
      • setShutdown

        void setShutdown​(java.lang.String shutdown)
        Set the shutdown command we are waiting for.
        Parameters:
        shutdown - The new shutdown command
      • getParentClassLoader

        java.lang.ClassLoader getParentClassLoader()
        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.
      • setParentClassLoader

        void setParentClassLoader​(java.lang.ClassLoader parent)
        Set the parent class loader for this server.
        Parameters:
        parent - The new parent class loader
      • getCatalina

        Catalina getCatalina()
        Returns:
        the outer Catalina startup/shutdown component if present.
      • setCatalina

        void setCatalina​(Catalina catalina)
        Set the outer Catalina startup/shutdown component if present.
        Parameters:
        catalina - the outer Catalina component
      • getCatalinaBase

        java.io.File getCatalinaBase()
        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.
      • setCatalinaBase

        void setCatalinaBase​(java.io.File catalinaBase)
        Set the configured base (instance) directory. Note that home and base may be the same (and are by default).
        Parameters:
        catalinaBase - the configured base directory
      • getCatalinaHome

        java.io.File getCatalinaHome()
        Returns:
        the configured home (binary) directory. Note that home and base may be the same (and are by default).
      • setCatalinaHome

        void setCatalinaHome​(java.io.File catalinaHome)
        Set the configured home (binary) directory. Note that home and base may be the same (and are by default).
        Parameters:
        catalinaHome - the configured home directory
      • getUtilityThreads

        int getUtilityThreads()
        Get the utility thread count.
        Returns:
        the thread count
      • setUtilityThreads

        void setUtilityThreads​(int utilityThreads)
        Set the utility thread count.
        Parameters:
        utilityThreads - the new thread count
      • addService

        void addService​(Service service)
        Add a new Service to the set of defined Services.
        Parameters:
        service - The Service to be added
      • await

        void await()
        Wait until a proper shutdown command is received, then return.
      • findService

        Service findService​(java.lang.String name)
        Find the specified Service
        Parameters:
        name - Name of the Service to be returned
        Returns:
        the specified Service, or null if none exists.
      • findServices

        Service[] findServices()
        Returns:
        the set of Services defined within this Server.
      • removeService

        void removeService​(Service service)
        Remove the specified Service from the set associated from this Server.
        Parameters:
        service - The Service to be removed
      • getNamingToken

        java.lang.Object getNamingToken()
        Returns:
        the token necessary for operations on the associated JNDI naming context.
      • getUtilityExecutor

        java.util.concurrent.ScheduledExecutorService getUtilityExecutor()
        Returns:
        the utility executor managed by the Service.