第四章 shardingsphere源码-如何启动的?

本文详细描述了项目启动过程,使用Netty作为服务器,涉及BootstrapArguments、YamlProxyConfiguration、ServerBootstrap初始化、ChannelFuture等关键组件,展示了从配置到接收客户端请求的核心逻辑。


一、项目启动核心源码

上一篇文章说了项目真正启动之前,所做的准备工作,大体就是 将配置信息进行解析成对象,然后按照注册中心 进行持久化,
本篇介绍一下,这个项目到底是使用什么启动的?答案借助于netty

1.new ShardingSphereProxy().start(port, addresses); 使用了netty作为服务器

    public static void main(final String[] args) throws IOException, SQLException {
   
   
        BootstrapArguments bootstrapArgs = new BootstrapArguments(args);
        YamlProxyConfiguration yamlConfig = ProxyConfigurationLoader.load(bootstrapArgs.getConfigurationPath());
        int port = bootstrapArgs.getPort().orElseGet(() -> new ConfigurationProperties(yamlConfig.getServerConfiguration().getProps()).getValue(ConfigurationPropertyKey.PROXY_DEFAULT_PORT));
        List<String> addresses = bootstrapArgs.getAddresses();
        new BootstrapInitializer().init(yamlConfig, port, bootstrapArgs.getForce());
        boolean cdcEnabled = null != yamlConfig.getServerConfiguration().getCdc() && yamlConfig.getServerConfiguration().getCdc().isEnabled();
        if (cdcEnabled)
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值