Search in sources :

Example 11 with TransportConf

use of com.baidu.hugegraph.computer.core.network.TransportConf in project hugegraph-computer by hugegraph.

the class NettyClientFactoryTest method testInit.

@Test
public void testInit() {
    TransportConf conf = TransportConf.wrapConfig(config);
    NettyClientFactory clientFactory = new NettyClientFactory(conf);
    clientFactory.init();
    Object bootstrap = Whitebox.getInternalState(clientFactory, "bootstrap");
    Assert.assertNotNull(bootstrap);
}
Also used : TransportConf(com.baidu.hugegraph.computer.core.network.TransportConf) Test(org.junit.Test)

Example 12 with TransportConf

use of com.baidu.hugegraph.computer.core.network.TransportConf in project hugegraph-computer by hugegraph.

the class TransportConnectionManager method startServer.

@Override
public synchronized int startServer(Config config, MessageHandler serverHandler) {
    E.checkArgument(this.server == null, "The TransportServer has already been listened");
    E.checkArgumentNotNull(serverHandler, "The serverHandler param can't be null");
    TransportConf conf = TransportConf.wrapConfig(config);
    TransportServer server = conf.transportProvider().createServer(conf);
    int bindPort = server.listen(config, serverHandler);
    this.server = server;
    return bindPort;
}
Also used : TransportServer(com.baidu.hugegraph.computer.core.network.TransportServer) TransportConf(com.baidu.hugegraph.computer.core.network.TransportConf)

Example 13 with TransportConf

use of com.baidu.hugegraph.computer.core.network.TransportConf in project hugegraph-computer by hugegraph.

the class TransportConnectionManager method initClientManager.

@Override
public synchronized void initClientManager(Config config, ClientHandler clientHandler) {
    E.checkArgument(this.clientFactory == null, "The clientManager has already been initialized");
    E.checkArgumentNotNull(clientHandler, "The clientHandler parameter can't be null");
    TransportConf conf = TransportConf.wrapConfig(config);
    TransportProvider provider = conf.transportProvider();
    ClientFactory factory = provider.createClientFactory(conf);
    factory.init();
    this.clientFactory = factory;
    this.clientHandler = clientHandler;
}
Also used : ClientFactory(com.baidu.hugegraph.computer.core.network.ClientFactory) TransportConf(com.baidu.hugegraph.computer.core.network.TransportConf) TransportProvider(com.baidu.hugegraph.computer.core.network.TransportProvider)

Aggregations

TransportConf (com.baidu.hugegraph.computer.core.network.TransportConf)13 Test (org.junit.Test)11 ConnectionId (com.baidu.hugegraph.computer.core.network.ConnectionId)4 ClientFactory (com.baidu.hugegraph.computer.core.network.ClientFactory)1 TransportProvider (com.baidu.hugegraph.computer.core.network.TransportProvider)1 TransportServer (com.baidu.hugegraph.computer.core.network.TransportServer)1 InetAddress (java.net.InetAddress)1