Commit c10ea28e authored by TousakaRin's avatar TousakaRin

delete method MethodStatus::max_concurrency_ref()

parent 93ba5e32
...@@ -28,7 +28,7 @@ ConcurrencyLimiter* ConcurrencyLimiter::CreateConcurrencyLimiterOrDie( ...@@ -28,7 +28,7 @@ ConcurrencyLimiter* ConcurrencyLimiter::CreateConcurrencyLimiterOrDie(
ConcurrencyLimiter* cl_copy = cl->New(); ConcurrencyLimiter* cl_copy = cl->New();
CHECK(cl_copy != NULL) << "Fail to new ConcurrencyLimiter"; CHECK(cl_copy != NULL) << "Fail to new ConcurrencyLimiter";
if (max_concurrency == "constant") { if (max_concurrency == "constant") {
cl_copy->SetMaxConcurrency(max_concurrency); cl_copy->_max_concurrency = max_concurrency;
} }
return cl_copy; return cl_copy;
} }
......
...@@ -127,22 +127,6 @@ void MethodStatus::Describe( ...@@ -127,22 +127,6 @@ void MethodStatus::Describe(
_nprocessing, options, false); _nprocessing, options, false);
} }
int& MethodStatus::max_concurrency_ref() {
if (NULL == _cl) {
const ConcurrencyLimiter* cl =
ConcurrencyLimiterExtension()->Find("constant");
if (NULL == cl) {
LOG(FATAL) << "Fail to find ConcurrentLimiter by `constant`";
}
ConcurrencyLimiter* cl_copy = cl->New();
if (NULL == cl_copy) {
LOG(FATAL) << "Fail to new ConcurrencyLimiter";
}
_cl = cl_copy;
}
return _cl->MaxConcurrencyRef();
}
void MethodStatus::SetConcurrencyLimiter(ConcurrencyLimiter* cl) { void MethodStatus::SetConcurrencyLimiter(ConcurrencyLimiter* cl) {
if (NULL != _cl) { if (NULL != _cl) {
_cl->Destroy(); _cl->Destroy();
......
...@@ -68,9 +68,8 @@ friend class ScopedMethodStatus; ...@@ -68,9 +68,8 @@ friend class ScopedMethodStatus;
friend class Server; friend class Server;
DISALLOW_COPY_AND_ASSIGN(MethodStatus); DISALLOW_COPY_AND_ASSIGN(MethodStatus);
// Note: Following methods are not thread safe and can only be called // Note: SetConcurrencyLimiter() is not thread safe and can only be called
// before the server is started. // before the server is started.
int& max_concurrency_ref();
void SetConcurrencyLimiter(ConcurrencyLimiter* cl); void SetConcurrencyLimiter(ConcurrencyLimiter* cl);
ConcurrencyLimiter* _cl; ConcurrencyLimiter* _cl;
......
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
void RemoveConcurrency(const Controller* c) { void RemoveConcurrency(const Controller* c) {
if (c->has_flag(Controller::FLAGS_ADDED_CONCURRENCY)){ if (c->has_flag(Controller::FLAGS_ADDED_CONCURRENCY)){
CHECK(_server->_cl != NULL) CHECK(_server->_cl != NULL);
_server->_cl->OnResponded(c->ErrorCode(), c->latency_us()); _server->_cl->OnResponded(c->ErrorCode(), c->latency_us());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment