// Path: redant-core/src/main/java/com/redant/core/server/NettyHttpServer.java
// public final class NettyHttpServer implements Server {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(NettyHttpServer.class);
// 
//     @Override
//     public void preStart() {
//         InitExecutor.init();
//     }
// 
//     @Override
//     public void start() {
//         EventLoopGroup bossGroup = new NioEventLoopGroup(CommonConstants.BOSS_GROUP_SIZE, new DefaultThreadFactory("boss", true));
//         EventLoopGroup workerGroup = new NioEventLoopGroup(CommonConstants.WORKER_GROUP_SIZE, new DefaultThreadFactory("worker", true));
//         try {
//             long start = System.currentTimeMillis();
//             ServerBootstrap b = new ServerBootstrap();
//             b.option(ChannelOption.SO_BACKLOG, 1024);
//             b.group(bossGroup, workerGroup)
//              .channel(NioServerSocketChannel.class)
// //             .handler(new LoggingHandler(LogLevel.INFO))
//              .childHandler(new NettyHttpServerInitializer());
// 
//             ChannelFuture future = b.bind(CommonConstants.SERVER_PORT).sync();
//             long cost = System.currentTimeMillis()-start;
//             LOGGER.info("[NettyHttpServer] Startup at port:{} cost:{}[ms]",CommonConstants.SERVER_PORT,cost);
// 
//             // 等待服务端Socket关闭
//             future.channel().closeFuture().sync();
//         } catch (InterruptedException e) {
//             LOGGER.error("[NettyHttpServer] InterruptedException:",e);
//         } finally {
//             bossGroup.shutdownGracefully();
//             workerGroup.shutdownGracefully();
//         }
//     }
// 
// 
// }
// 
// Path: redant-core/src/main/java/com/redant/core/server/Server.java
// public interface Server {
// 
//     /**
//      * 启动服务器之前的事件处理
//      */
//     void preStart();
// 
//     /**
//      * 启动服务器
//      */
//     void start();
// 
// }


import com.redant.core.server.NettyHttpServer;
import com.redant.core.server.Server;
package com.redant.core;


/**
 * 服务端启动入口
 * @author houyi.wh
 * @date 2017-10-20
 */
public final class ServerBootstrap {

    public static void main(String[] args) {
// Path: redant-core/src/main/java/com/redant/core/server/NettyHttpServer.java
// public final class NettyHttpServer implements Server {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(NettyHttpServer.class);
// 
//     @Override
//     public void preStart() {
//         InitExecutor.init();
//     }
// 
//     @Override
//     public void start() {
//         EventLoopGroup bossGroup = new NioEventLoopGroup(CommonConstants.BOSS_GROUP_SIZE, new DefaultThreadFactory("boss", true));
//         EventLoopGroup workerGroup = new NioEventLoopGroup(CommonConstants.WORKER_GROUP_SIZE, new DefaultThreadFactory("worker", true));
//         try {
//             long start = System.currentTimeMillis();
//             ServerBootstrap b = new ServerBootstrap();
//             b.option(ChannelOption.SO_BACKLOG, 1024);
//             b.group(bossGroup, workerGroup)
//              .channel(NioServerSocketChannel.class)
// //             .handler(new LoggingHandler(LogLevel.INFO))
//              .childHandler(new NettyHttpServerInitializer());
// 
//             ChannelFuture future = b.bind(CommonConstants.SERVER_PORT).sync();
//             long cost = System.currentTimeMillis()-start;
//             LOGGER.info("[NettyHttpServer] Startup at port:{} cost:{}[ms]",CommonConstants.SERVER_PORT,cost);
// 
//             // 等待服务端Socket关闭
//             future.channel().closeFuture().sync();
//         } catch (InterruptedException e) {
//             LOGGER.error("[NettyHttpServer] InterruptedException:",e);
//         } finally {
//             bossGroup.shutdownGracefully();
//             workerGroup.shutdownGracefully();
//         }
//     }
// 
// 
// }
// 
// Path: redant-core/src/main/java/com/redant/core/server/Server.java
// public interface Server {
// 
//     /**
//      * 启动服务器之前的事件处理
//      */
//     void preStart();
// 
//     /**
//      * 启动服务器
//      */
//     void start();
// 
// }


// Path: redant-core/src/main/java/com/redant/core/ServerBootstrap.java
import com.redant.core.server.NettyHttpServer;
import com.redant.core.server.Server;

package com.redant.core;


/**
 * 服务端启动入口
 * @author houyi.wh
 * @date 2017-10-20
 */
public final class ServerBootstrap {

    public static void main(String[] args) {
        Server nettyServer = new NettyHttpServer();