You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/11/02 03:23:06 UTC
[iotdb] branch master updated: Stop iotdb instance when RPC ip
address or port is unavailable (#1868)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 913f0b7 Stop iotdb instance when RPC ip address or port is unavailable (#1868)
913f0b7 is described below
commit 913f0b748fe9ab927ea257f316b0d959a886db05
Author: Haonan <hh...@outlook.com>
AuthorDate: Mon Nov 2 11:22:51 2020 +0800
Stop iotdb instance when RPC ip address or port is unavailable (#1868)
---
.../java/org/apache/iotdb/db/service/RPCService.java | 20 +++++++++++++-------
.../iotdb/db/service/thrift/ThriftService.java | 3 ++-
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/service/RPCService.java b/server/src/main/java/org/apache/iotdb/db/service/RPCService.java
index 6da5eab..73646e3 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/RPCService.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/RPCService.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.db.service;
import org.apache.iotdb.db.concurrent.ThreadName;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.exception.runtime.RPCServiceException;
import org.apache.iotdb.db.service.thrift.ThriftService;
import org.apache.iotdb.db.service.thrift.ThriftServiceThread;
import org.apache.iotdb.service.rpc.thrift.TSIService.Processor;
@@ -51,7 +52,8 @@ public class RPCService extends ThriftService implements RPCServiceMBean {
}
@Override
- public void initTProcessor() throws ClassNotFoundException,IllegalAccessException,InstantiationException{
+ public void initTProcessor()
+ throws ClassNotFoundException, IllegalAccessException, InstantiationException {
impl = (TSServiceImpl) Class.forName(IoTDBDescriptor.getInstance().getConfig()
.getRpcImplClassName()).newInstance();
processor = new Processor<>(impl);
@@ -61,12 +63,16 @@ public class RPCService extends ThriftService implements RPCServiceMBean {
public void initThriftServiceThread()
throws IllegalAccessException, InstantiationException, ClassNotFoundException {
IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
- thriftServiceThread = new ThriftServiceThread(processor,
- getID().getName(), ThreadName.RPC_CLIENT.getName(),
- config.getRpcAddress(), config.getRpcPort(), config.getRpcMaxConcurrentClientNum(),
- config.getThriftServerAwaitTimeForStopService(),
- new RPCServiceThriftHandler(impl),
- IoTDBDescriptor.getInstance().getConfig().isRpcThriftCompressionEnable());
+ try {
+ thriftServiceThread = new ThriftServiceThread(processor,
+ getID().getName(), ThreadName.RPC_CLIENT.getName(),
+ config.getRpcAddress(), config.getRpcPort(), config.getRpcMaxConcurrentClientNum(),
+ config.getThriftServerAwaitTimeForStopService(),
+ new RPCServiceThriftHandler(impl),
+ IoTDBDescriptor.getInstance().getConfig().isRpcThriftCompressionEnable());
+ } catch (RPCServiceException e) {
+ throw new IllegalAccessException(e.getMessage());
+ }
thriftServiceThread.setName(ThreadName.RPC_SERVICE.getName());
}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/thrift/ThriftService.java b/server/src/main/java/org/apache/iotdb/db/service/thrift/ThriftService.java
index c4c3d56..8fe34ba 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/thrift/ThriftService.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/thrift/ThriftService.java
@@ -81,7 +81,8 @@ public abstract class ThriftService implements IService {
JMXService.deregisterMBean(mbeanName);
}
- public abstract void initTProcessor() throws ClassNotFoundException,IllegalAccessException,InstantiationException;
+ public abstract void initTProcessor()
+ throws ClassNotFoundException, IllegalAccessException, InstantiationException;
public abstract void initThriftServiceThread()
throws IllegalAccessException, InstantiationException, ClassNotFoundException;
public abstract String getBindIP();