MCPcopy Create free account
hub / github.com/apache/brpc / Notify

Method Notify

example/auto_concurrency_limiter/server.cpp:207–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205 };
206
207 virtual void Notify(google::protobuf::RpcController* cntl_base,
208 const test::NotifyRequest* request,
209 test::NotifyResponse* response,
210 google::protobuf::Closure* done) {
211 brpc::ClosureGuard done_guard(done);
212 const std::string& message = request->message();
213 LOG(INFO) << message;
214 if (message == "ResetCaseSet") {
215 _server.Stop(0);
216 _server.Join();
217 _echo_service->StopTestCase();
218
219 LoadCaseSet(FLAGS_case_file);
220 _case_index = 0;
221 response->set_message("CaseSetReset");
222 } else if (message == "StartCase") {
223 CHECK(!_server.IsRunning()) << "Continuous StartCase";
224 const test::TestCase& test_case = _case_set.test_case(_case_index++);
225 _echo_service->SetTestCase(test_case);
226 brpc::ServerOptions options;
227 options.max_concurrency = FLAGS_server_max_concurrency;
228 _server.MaxConcurrencyOf("test.EchoService.Echo") = test_case.max_concurrency();
229
230 _server.Start(FLAGS_echo_port, &options);
231 _echo_service->StartTestCase();
232 response->set_message("CaseStarted");
233 } else if (message == "StopCase") {
234 CHECK(_server.IsRunning()) << "Continuous StopCase";
235 _server.Stop(0);
236 _server.Join();
237
238 _echo_service->StopTestCase();
239 response->set_message("CaseStopped");
240 } else {
241 LOG(FATAL) << "Invalid message:" << message;
242 response->set_message("Invalid Cntl Message");
243 }
244 }
245
246private:
247 void LoadCaseSet(const std::string& file_path) {

Callers 2

RunCaseFunction · 0.45
mainFunction · 0.45

Calls 10

LoadCaseSetFunction · 0.85
StopTestCaseMethod · 0.80
IsRunningMethod · 0.80
SetTestCaseMethod · 0.80
MaxConcurrencyOfMethod · 0.80
StartTestCaseMethod · 0.80
messageMethod · 0.45
StopMethod · 0.45
JoinMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected