Remove unused code

Former-commit-id: a8b9985902792c6b8c884a284fe0fad1c6515b3a
pull/191/head
jinhai 2019-07-03 20:23:21 +08:00
parent 0bc554cf77
commit a66c229efd
2 changed files with 12 additions and 22 deletions

View File

@ -50,7 +50,6 @@ MilvusServer::StartService() {
std::string address = server_config.GetValue(CONFIG_SERVER_ADDRESS, "127.0.0.1"); std::string address = server_config.GetValue(CONFIG_SERVER_ADDRESS, "127.0.0.1");
int32_t port = server_config.GetInt32Value(CONFIG_SERVER_PORT, 19530); int32_t port = server_config.GetInt32Value(CONFIG_SERVER_PORT, 19530);
std::string protocol = server_config.GetValue(CONFIG_SERVER_PROTOCOL, "binary"); std::string protocol = server_config.GetValue(CONFIG_SERVER_PROTOCOL, "binary");
std::string mode = server_config.GetValue(CONFIG_SERVER_MODE, "thread_pool");
try { try {
DBWrapper::DB();//initialize db DBWrapper::DB();//initialize db
@ -68,30 +67,22 @@ MilvusServer::StartService() {
} else if (protocol == "compact") { } else if (protocol == "compact") {
protocol_factory.reset(new TCompactProtocolFactory()); protocol_factory.reset(new TCompactProtocolFactory());
} else { } else {
//SERVER_LOG_INFO << "Service protocol: " << protocol << " is not supported currently"; // SERVER_LOG_INFO << "Service protocol: " << protocol << " is not supported currently";
return; return;
} }
std::string mode = "thread_pool"; stdcxx::shared_ptr<ThreadManager> threadManager(ThreadManager::newSimpleThreadManager());
if (mode == "simple") { stdcxx::shared_ptr<PosixThreadFactory> threadFactory(new PosixThreadFactory());
s_server.reset(new TSimpleServer(processor, server_transport, transport_factory, protocol_factory)); threadManager->threadFactory(threadFactory);
s_server->serve(); threadManager->start();
} else if (mode == "thread_pool") {
stdcxx::shared_ptr<ThreadManager> threadManager(ThreadManager::newSimpleThreadManager()); s_server.reset(new ThreadPoolServer(processor,
stdcxx::shared_ptr<PosixThreadFactory> threadFactory(new PosixThreadFactory()); server_transport,
threadManager->threadFactory(threadFactory); transport_factory,
threadManager->start(); protocol_factory,
threadManager));
s_server->serve();
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;
}
} catch (apache::thrift::TException& ex) { } catch (apache::thrift::TException& ex) {
std::cout << "ERROR! " << ex.what() << std::endl; std::cout << "ERROR! " << ex.what() << std::endl;
kill(0, SIGUSR1); kill(0, SIGUSR1);

View File

@ -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_ADDRESS = "address";
static const std::string CONFIG_SERVER_PORT = "port"; static const std::string CONFIG_SERVER_PORT = "port";
static const std::string CONFIG_SERVER_PROTOCOL = "transfer_protocol"; 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_CLUSTER_MODE = "mode";
static const std::string CONFIG_DB = "db_config"; static const std::string CONFIG_DB = "db_config";