Search in sources :

Example 1 with RemotingServer

use of com.alipay.remoting.RemotingServer in project hugegraph-common by hugegraph.

the class RpcServer method port.

public int port() {
    this.checkEnabled();
    Server server = this.serverConfig.getServer();
    if (server instanceof BoltServer && server.isStarted()) {
        /*
             * When using random port 0, try to fetch the actual port
             * NOTE: RemotingServer.port() would return the actual port only
             *       if sofa-bolt version >= 1.6.1, please see:
             *       https://github.com/sofastack/sofa-bolt/issues/196
             * TODO: remove this code after adding Server.port() interface:
             *       https://github.com/sofastack/sofa-rpc/issues/1022
             */
        RemotingServer rs = Whitebox.getInternalState(server, "remotingServer");
        return rs.port();
    }
    // When using random port 0, the returned port is not the actual port
    return this.serverConfig.getPort();
}
Also used : BoltServer(com.alipay.sofa.rpc.server.bolt.BoltServer) RemotingServer(com.alipay.remoting.RemotingServer) Server(com.alipay.sofa.rpc.server.Server) RemotingServer(com.alipay.remoting.RemotingServer) BoltServer(com.alipay.sofa.rpc.server.bolt.BoltServer)

Example 2 with RemotingServer

use of com.alipay.remoting.RemotingServer in project sofa-rpc by sofastack.

the class BoltServer method initRemotingServer.

protected RemotingServer initRemotingServer() {
    // 绑定到端口
    RemotingServer remotingServer = new RpcServer(serverConfig.getBoundHost(), serverConfig.getPort());
    remotingServer.registerUserProcessor(boltServerProcessor);
    return remotingServer;
}
Also used : RpcServer(com.alipay.remoting.rpc.RpcServer) RemotingServer(com.alipay.remoting.RemotingServer)

Aggregations

RemotingServer (com.alipay.remoting.RemotingServer)2 RpcServer (com.alipay.remoting.rpc.RpcServer)1 Server (com.alipay.sofa.rpc.server.Server)1 BoltServer (com.alipay.sofa.rpc.server.bolt.BoltServer)1