频道栏目
首页 > 资讯 > 组件/库 > 正文

知识库--Server + Service

16-12-26        来源:[db:作者]  
收藏   我要投稿

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 individually 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;
    }
相关TAG标签
上一篇:以太坊go-ethereum客户端docker安装(二)开发(dev)环境搭建
下一篇:Ubuntu16.10下php7.0-fpm与Nginx配置
相关文章
图文推荐

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

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