Search in sources :

Example 1 with NettyTransportClient

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

the class SenderIntegrateTest method slowSendFunc.

private void slowSendFunc(WorkerService service) throws TransportException {
    Managers managers = Whitebox.getInternalState(service, "managers");
    DataClientManager clientManager = managers.get(DataClientManager.NAME);
    ConnectionManager connManager = Whitebox.getInternalState(clientManager, "connManager");
    NettyTransportClient client = (NettyTransportClient) connManager.getOrCreateClient("127.0.0.1", 8091);
    ClientSession clientSession = Whitebox.invoke(client.getClass(), "clientSession", client);
    Function<Message, Future<Void>> sendFuncBak = Whitebox.getInternalState(clientSession, "sendFunction");
    Function<Message, Future<Void>> sendFunc = message -> {
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return sendFuncBak.apply(message);
    };
    Whitebox.setInternalState(clientSession, "sendFunction", sendFunc);
}
Also used : PageRankParams(com.baidu.hugegraph.computer.algorithm.centrality.pagerank.PageRankParams) ComputerOptions(com.baidu.hugegraph.computer.core.config.ComputerOptions) DoubleValue(com.baidu.hugegraph.computer.core.graph.value.DoubleValue) BeforeClass(org.junit.BeforeClass) Managers(com.baidu.hugegraph.computer.core.manager.Managers) RpcOptions(com.baidu.hugegraph.config.RpcOptions) Function(java.util.function.Function) MasterService(com.baidu.hugegraph.computer.core.master.MasterService) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) Whitebox(com.baidu.hugegraph.testutil.Whitebox) TransportException(com.baidu.hugegraph.computer.core.common.exception.TransportException) ComputerContextUtil(com.baidu.hugegraph.computer.core.util.ComputerContextUtil) Message(com.baidu.hugegraph.computer.core.network.message.Message) AfterClass(org.junit.AfterClass) Logger(org.slf4j.Logger) ConnectionManager(com.baidu.hugegraph.computer.core.network.connection.ConnectionManager) Test(org.junit.Test) NettyTransportClient(com.baidu.hugegraph.computer.core.network.netty.NettyTransportClient) ClientSession(com.baidu.hugegraph.computer.core.network.session.ClientSession) Config(com.baidu.hugegraph.computer.core.config.Config) DataClientManager(com.baidu.hugegraph.computer.core.network.DataClientManager) List(java.util.List) Log(com.baidu.hugegraph.util.Log) WorkerService(com.baidu.hugegraph.computer.core.worker.WorkerService) Assert(com.baidu.hugegraph.testutil.Assert) ConnectionManager(com.baidu.hugegraph.computer.core.network.connection.ConnectionManager) Message(com.baidu.hugegraph.computer.core.network.message.Message) Managers(com.baidu.hugegraph.computer.core.manager.Managers) DataClientManager(com.baidu.hugegraph.computer.core.network.DataClientManager) NettyTransportClient(com.baidu.hugegraph.computer.core.network.netty.NettyTransportClient) ClientSession(com.baidu.hugegraph.computer.core.network.session.ClientSession) Future(java.util.concurrent.Future)

Aggregations

PageRankParams (com.baidu.hugegraph.computer.algorithm.centrality.pagerank.PageRankParams)1 TransportException (com.baidu.hugegraph.computer.core.common.exception.TransportException)1 ComputerOptions (com.baidu.hugegraph.computer.core.config.ComputerOptions)1 Config (com.baidu.hugegraph.computer.core.config.Config)1 DoubleValue (com.baidu.hugegraph.computer.core.graph.value.DoubleValue)1 Managers (com.baidu.hugegraph.computer.core.manager.Managers)1 MasterService (com.baidu.hugegraph.computer.core.master.MasterService)1 DataClientManager (com.baidu.hugegraph.computer.core.network.DataClientManager)1 ConnectionManager (com.baidu.hugegraph.computer.core.network.connection.ConnectionManager)1 Message (com.baidu.hugegraph.computer.core.network.message.Message)1 NettyTransportClient (com.baidu.hugegraph.computer.core.network.netty.NettyTransportClient)1 ClientSession (com.baidu.hugegraph.computer.core.network.session.ClientSession)1 ComputerContextUtil (com.baidu.hugegraph.computer.core.util.ComputerContextUtil)1 WorkerService (com.baidu.hugegraph.computer.core.worker.WorkerService)1 RpcOptions (com.baidu.hugegraph.config.RpcOptions)1 Assert (com.baidu.hugegraph.testutil.Assert)1 Whitebox (com.baidu.hugegraph.testutil.Whitebox)1 Log (com.baidu.hugegraph.util.Log)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1