From 64dc9b42a88f7e96c2f7336bd80e636e72101a4d Mon Sep 17 00:00:00 2001 From: JackyYangPassion Date: Wed, 6 Jul 2022 19:33:23 +0800 Subject: [PATCH 1/2] fix start rpcServer NPE --- .../java/com/baidu/hugegraph/core/GraphManager.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java index f5e1643274..896c95861e 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java @@ -307,6 +307,7 @@ private void startRpcServer() { private com.alipay.remoting.rpc.RpcServer remotingRpcServer() { ServerConfig serverConfig = Whitebox.getInternalState(this.rpcServer, "serverConfig"); + serverConfig.buildIfAbsent(); return Whitebox.getInternalState(serverConfig.getServer(), "remotingServer"); } @@ -378,11 +379,13 @@ private void loadGraph(String name, String graphConfPath) { } private void waitGraphsReady() { - com.alipay.remoting.rpc.RpcServer remotingRpcServer = - this.remotingRpcServer(); - for (String graphName : this.graphs.keySet()) { - HugeGraph graph = this.graph(graphName); - graph.waitReady(remotingRpcServer); + if (!this.rpcServer.enabled()) { + com.alipay.remoting.rpc.RpcServer remotingRpcServer = + this.remotingRpcServer(); + for (String graphName : this.graphs.keySet()) { + HugeGraph graph = this.graph(graphName); + graph.waitReady(remotingRpcServer); + } } } From 63476a25d2cff87d1689a9b4a6afdbd415624c14 Mon Sep 17 00:00:00 2001 From: JackyYangPassion Date: Wed, 6 Jul 2022 20:07:21 +0800 Subject: [PATCH 2/2] fix start rpcServer NPE --- .../com/baidu/hugegraph/core/GraphManager.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java index 896c95861e..83859a76e7 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/core/GraphManager.java @@ -380,12 +380,14 @@ private void loadGraph(String name, String graphConfPath) { private void waitGraphsReady() { if (!this.rpcServer.enabled()) { - com.alipay.remoting.rpc.RpcServer remotingRpcServer = - this.remotingRpcServer(); - for (String graphName : this.graphs.keySet()) { - HugeGraph graph = this.graph(graphName); - graph.waitReady(remotingRpcServer); - } + LOG.info("RpcServer is not enabled, skip wait graphs ready"); + return; + } + com.alipay.remoting.rpc.RpcServer remotingRpcServer = + this.remotingRpcServer(); + for (String graphName : this.graphs.keySet()) { + HugeGraph graph = this.graph(graphName); + graph.waitReady(remotingRpcServer); } }