aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/server/health
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2017-02-07 13:50:36 -0800
committerGravatar yang-g <yangg@google.com>2017-02-07 13:50:36 -0800
commit076bac017b200accb8071e569b471f118fc3ba32 (patch)
tree11bc758fb3908805642e4cce1fcbd26e4e2c6ad5 /src/cpp/server/health
parent13a537bcae9d21587deda4ca70428bb254e6daa0 (diff)
Remove async
Diffstat (limited to 'src/cpp/server/health')
-rw-r--r--src/cpp/server/health/default_health_check_service.cc17
-rw-r--r--src/cpp/server/health/default_health_check_service.h11
2 files changed, 9 insertions, 19 deletions
diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc
index 9743bd5775..46def70e8a 100644
--- a/src/cpp/server/health/default_health_check_service.cc
+++ b/src/cpp/server/health/default_health_check_service.cc
@@ -49,14 +49,11 @@ const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check";
} // namespace
DefaultHealthCheckService::HealthCheckServiceImpl::HealthCheckServiceImpl(
- DefaultHealthCheckService* service, bool sync)
- : service_(service), method_(nullptr), sync_(sync) {
- MethodHandler* handler = nullptr;
- if (sync_) {
- handler =
- new RpcMethodHandler<HealthCheckServiceImpl, ByteBuffer, ByteBuffer>(
- std::mem_fn(&HealthCheckServiceImpl::Check), this);
- }
+ DefaultHealthCheckService* service)
+ : service_(service), method_(nullptr) {
+ MethodHandler* handler =
+ new RpcMethodHandler<HealthCheckServiceImpl, ByteBuffer, ByteBuffer>(
+ std::mem_fn(&HealthCheckServiceImpl::Check), this);
method_ = new RpcServiceMethod(kHealthCheckMethodName, RpcMethod::NORMAL_RPC,
handler);
AddMethod(method_);
@@ -160,9 +157,9 @@ DefaultHealthCheckService::GetServingStatus(
}
DefaultHealthCheckService::HealthCheckServiceImpl*
-DefaultHealthCheckService::GetHealthCheckService(bool sync) {
+DefaultHealthCheckService::GetHealthCheckService() {
GPR_ASSERT(impl_ == nullptr);
- impl_.reset(new HealthCheckServiceImpl(this, sync));
+ impl_.reset(new HealthCheckServiceImpl(this));
return impl_.get();
}
diff --git a/src/cpp/server/health/default_health_check_service.h b/src/cpp/server/health/default_health_check_service.h
index 1ecb0a2ba9..5c0e230342 100644
--- a/src/cpp/server/health/default_health_check_service.h
+++ b/src/cpp/server/health/default_health_check_service.h
@@ -49,21 +49,14 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface {
// The service impl to register with the server.
class HealthCheckServiceImpl : public Service {
public:
- HealthCheckServiceImpl(DefaultHealthCheckService* service, bool sync);
+ explicit HealthCheckServiceImpl(DefaultHealthCheckService* service);
Status Check(ServerContext* context, const ByteBuffer* request,
ByteBuffer* response);
- bool sync() { return sync_; }
-
- // This is only useful for the async mode. It should be called after
- // RegisterService returns.
- void* server_tag() const { return method_->server_tag(); }
-
private:
const DefaultHealthCheckService* const service_;
RpcServiceMethod* method_;
- const bool sync_;
};
DefaultHealthCheckService();
@@ -72,7 +65,7 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface {
void SetServingStatus(bool serving) override;
enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING };
ServingStatus GetServingStatus(const grpc::string& service_name) const;
- HealthCheckServiceImpl* GetHealthCheckService(bool sync);
+ HealthCheckServiceImpl* GetHealthCheckService();
private:
mutable std::mutex mu_;