From 6092b1be997c27d89f4858d4e5b239046b0889e8 Mon Sep 17 00:00:00 2001 From: jinhai Date: Wed, 3 Jul 2019 20:23:21 +0800 Subject: [PATCH] Remove unused code Former-commit-id: 5be2fd19cb451599de0c242b9023c5a15b45e204 --- cpp/src/server/MilvusServer.cpp | 35 ++++++++++++--------------------- cpp/src/server/ServerConfig.h | 1 - 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/cpp/src/server/MilvusServer.cpp b/cpp/src/server/MilvusServer.cpp index 32246096..452ee3af 100644 --- a/cpp/src/server/MilvusServer.cpp +++ b/cpp/src/server/MilvusServer.cpp @@ -50,7 +50,6 @@ MilvusServer::StartService() { std::string address = server_config.GetValue(CONFIG_SERVER_ADDRESS, "127.0.0.1"); int32_t port = server_config.GetInt32Value(CONFIG_SERVER_PORT, 19530); std::string protocol = server_config.GetValue(CONFIG_SERVER_PROTOCOL, "binary"); - std::string mode = server_config.GetValue(CONFIG_SERVER_MODE, "thread_pool"); try { DBWrapper::DB();//initialize db @@ -68,30 +67,22 @@ MilvusServer::StartService() { } else if (protocol == "compact") { protocol_factory.reset(new TCompactProtocolFactory()); } else { - //SERVER_LOG_INFO << "Service protocol: " << protocol << " is not supported currently"; + // SERVER_LOG_INFO << "Service protocol: " << protocol << " is not supported currently"; return; } - std::string mode = "thread_pool"; - if (mode == "simple") { - s_server.reset(new TSimpleServer(processor, server_transport, transport_factory, protocol_factory)); - s_server->serve(); - } else if (mode == "thread_pool") { - stdcxx::shared_ptr threadManager(ThreadManager::newSimpleThreadManager()); - stdcxx::shared_ptr threadFactory(new PosixThreadFactory()); - threadManager->threadFactory(threadFactory); - threadManager->start(); - - s_server.reset(new ThreadPoolServer(processor, - server_transport, - transport_factory, - protocol_factory, - threadManager)); - s_server->serve(); - } else { - //SERVER_LOG_INFO << "Service mode: " << mode << " is not supported currently"; - return; - } + stdcxx::shared_ptr threadManager(ThreadManager::newSimpleThreadManager()); + stdcxx::shared_ptr threadFactory(new PosixThreadFactory()); + threadManager->threadFactory(threadFactory); + threadManager->start(); + + s_server.reset(new ThreadPoolServer(processor, + server_transport, + transport_factory, + protocol_factory, + threadManager)); + s_server->serve(); + } catch (apache::thrift::TException& ex) { std::cout << "ERROR! " << ex.what() << std::endl; kill(0, SIGUSR1); diff --git a/cpp/src/server/ServerConfig.h b/cpp/src/server/ServerConfig.h index 412581bc..0ec04eed 100644 --- a/cpp/src/server/ServerConfig.h +++ b/cpp/src/server/ServerConfig.h @@ -18,7 +18,6 @@ static const std::string CONFIG_SERVER = "server_config"; static const std::string CONFIG_SERVER_ADDRESS = "address"; static const std::string CONFIG_SERVER_PORT = "port"; static const std::string CONFIG_SERVER_PROTOCOL = "transfer_protocol"; -static const std::string CONFIG_SERVER_MODE = "server_mode"; static const std::string CONFIG_CLUSTER_MODE = "mode"; static const std::string CONFIG_DB = "db_config"; -- GitLab