接上一篇博文,遺留了三個(gè)問(wèn)題正什。第一個(gè)問(wèn)題客戶端請(qǐng)求的http://localhost:8080/v1/statement
地址的服務(wù)是什么時(shí)候起來(lái)的
1啥纸、尋找服務(wù)器代碼
只有xml文件
一開(kāi)始以為在這個(gè)項(xiàng)目?jī)?nèi)。打開(kāi)看了下婴氮,只有presto.xml文件
<!-- Server -->
<artifactSet to="lib">
<artifact id="${project.groupId}:presto-main:${project.version}" />
</artifactSet>
<!-- Plugins -->
<artifactSet to="plugin/resource-group-managers">
<artifact id="${project.groupId}:presto-resource-group-managers:zip:${project.version}">
<unpack />
</artifact>
</artifactSet>
從xml文件中看到倆個(gè)注釋:<sever>和<plugins>
2斯棒、presto-main模塊入口
1盾致、在這個(gè)模塊中找到了(/v1/statement),這個(gè)應(yīng)該是restful api接收上一cli的請(qǐng)求荣暮。
package com.facebook.presto.server;
@Path("/v1/statement")
public class StatementResource
問(wèn)題:是誰(shuí)加載了這個(gè)類庭惜,讓http可以找到這個(gè)類?
2穗酥、CoordinatorModule協(xié)調(diào)器模塊加載各個(gè)資源护赊,并對(duì)外服務(wù)
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項(xiàng)目——注入框架
和 airlift的restful服務(wù)框架
3、最開(kāi)始的地方
public class PrestoServer
implements Runnable
{
public static void main(String[] args)
{
new PrestoServer().run();
}
3砾跃、PrestoServer啟動(dòng)
問(wèn)題:
1百揭、為什么在presto-server項(xiàng)目?jī)?nèi)使用xml這種方式。
2蜓席、注解的兩個(gè)<server>和<plugins>什么意思?作用是干嘛的呢课锌?
待續(xù)~~~