频道栏目
首页 > 程序开发 > 综合编程 > 组件/库 > 正文
知识库--Server + Service
2016-12-26 10:07:26      个评论    来源:qfzhangwei的专栏  
收藏   我要投稿

Server and Service

Overview

In previous chapters you have seen howve a servlet Container by instantiating a connector and container and then associating them with each other. Only one connector could be used, and that was to serve HTTP requests on port 8080. You could not add a you can hanother connector to service HTTPS requests, for example.

In addition, a good mechanism for starting and stopping the servlet container. Here, we’ll look at two other components that offer this mechanism as well as offer many other features: server and service.

Server

The org.apache.catalina.Server interface represents the entire Catallina servlet container and engulfs all other components. A server is particularly useful because it provides an elegant mechanism for starting and stopping the whole system. There is no need to start the connector and the container inpidually any longer.

Here is how the start and stop mechanism works. When you start a server, it starts all components inside it. It then waits indefinitely(无限等待) for a shutdown command. If you want to shut the system down, you send a shutdown command to designated port. This will reach the server and if it receives the right shutdown command, it will obey by stopping all its components.

A server uses another component, a service, to contain components such as a container and one or more connectors.

    public interface Server{
        public String getInfo();
        //Return the global naming resources
        public NamingResources getGlobalNamingResources();
        public void setGlobalNamingResources(NamingResources globalNamingResources);
        public int getPort();
        public void setPort(int port);
        public String getShutdown();
        public void setShutdown(String shutdown);
        public void addService(Service service);
        public void await();
        public Service findService(String name);
        public Service[] findServices();
        public void removeService(Service service);
        public void initialize()throws LifecycleException;
    }
点击复制链接 与好友分享!回本站首页
上一篇:知识库--StandardContext+backgroundProcess(60)
下一篇:知识库--Digester + ContextConfig(73)
相关文章
图文推荐
点击排行

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站