| 54 | } |
| 55 | |
| 56 | comm::RetCode Scheduler::Init() { |
| 57 | comm::RetCode ret; |
| 58 | |
| 59 | if (impl_->opt.log_func) { |
| 60 | comm::Logger::GetInstance()->SetLogFunc(impl_->opt.log_func); |
| 61 | } |
| 62 | |
| 63 | if (impl_->opt.config_factory_create_func) { |
| 64 | plugin::ConfigFactory::SetConfigFactoryCreateFunc(impl_->opt.config_factory_create_func); |
| 65 | } |
| 66 | |
| 67 | if (impl_->opt.break_point_factory_create_func) { |
| 68 | plugin::BreakPointFactory::SetBreakPointFactoryCreateFunc(impl_->opt.break_point_factory_create_func); |
| 69 | } |
| 70 | |
| 71 | impl_->addr.set_ip(impl_->opt.ip); |
| 72 | impl_->addr.set_port(impl_->opt.port); |
| 73 | |
| 74 | ret = InitTopicID(); |
| 75 | if (comm::RetCode::RET_OK != ret) { |
| 76 | QLErr("InitTopicID ret %d", as_integer(ret)); |
| 77 | |
| 78 | return ret; |
| 79 | } |
| 80 | |
| 81 | impl_->scheduler_mgr = unique_ptr<SchedulerMgr>(new SchedulerMgr(this)); |
| 82 | |
| 83 | impl_->load_balance_thread = unique_ptr<LoadBalanceThread>(new LoadBalanceThread(this)); |
| 84 | impl_->keep_master_thread = unique_ptr<KeepMasterThread>(new KeepMasterThread(this)); |
| 85 | |
| 86 | ret = impl_->scheduler_mgr->Init(); |
| 87 | if (comm::RetCode::RET_OK != ret) { |
| 88 | QLErr("scheduler_mgr Init ret %d", as_integer(ret)); |
| 89 | |
| 90 | return ret; |
| 91 | } |
| 92 | |
| 93 | impl_->load_balance_thread->Run(); |
| 94 | impl_->keep_master_thread->Run(); |
| 95 | |
| 96 | return comm::RetCode::RET_OK; |
| 97 | } |
| 98 | |
| 99 | comm::RetCode Scheduler::Dispose() { |
| 100 | comm::SchedulerBP::GetThreadInstance()->OnDispose(); |
nothing calls this directly
no test coverage detected