presto(四)——服务的启动

接上一篇博文,遗留了三个问题。第一个问题客户端请求的http://localhost:8080/v1/statement
地址的服务是什么时候起来的

1、寻找服务器代码

presto(四)——服务的启动_第1张图片
只有xml文件

一开始以为在这个项目内。打开看了下,只有presto.xml文件

  
    
        
    

    
    
        
            
        
    

从xml文件中看到俩个注释:

2、presto-main模块入口

1、在这个模块中找到了(/v1/statement),这个应该是restful api接收上一cli的请求。

package com.facebook.presto.server;

@Path("/v1/statement")
public class StatementResource

问题:是谁加载了这个类,让http可以找到这个类?

2、CoordinatorModule协调器模块加载各个资源,并对外服务

package com.facebook.presto.server;

public class CoordinatorModule
        extends AbstractConfigurationAwareModule
{
    @Override
    protected void setup(Binder binder)
    {
        httpServerBinder(binder).bindResource("/", "webapp").withWelcomeFile("index.html");

        // presto coordinator announcement
        discoveryBinder(binder).bindHttpAnnouncement("presto-coordinator");

        // statement resource
        jaxrsBinder(binder).bind(StatementResource.class);

这里涉及到google的inject项目——注入框架
和 airlift的restful服务框架

3、最开始的地方

public class PrestoServer
        implements Runnable
{
    public static void main(String[] args)
    {
        new PrestoServer().run();
    }

3、PrestoServer启动

问题:

1、为什么在presto-server项目内使用xml这种方式。
2、注解的两个什么意思?作用是干嘛的呢?

待续~~~

你可能感兴趣的:(presto(四)——服务的启动)