Package io.grpc.protobuf.services
Class HealthServiceImpl
- java.lang.Object
-
- io.grpc.health.v1.HealthGrpc.HealthImplBase
-
- io.grpc.protobuf.services.HealthServiceImpl
-
- All Implemented Interfaces:
BindableService
,HealthGrpc.AsyncService
final class HealthServiceImpl extends HealthGrpc.HealthImplBase
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
logger
private java.util.Map<java.lang.String,HealthCheckResponse.ServingStatus>
statusMap
private boolean
terminal
private java.util.HashMap<java.lang.String,java.util.IdentityHashMap<StreamObserver<HealthCheckResponse>,java.lang.Boolean>>
watchers
private java.lang.Object
watchLock
-
Constructor Summary
Constructors Constructor Description HealthServiceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
check(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver)
If the requested service is unknown, the call will fail with status NOT_FOUND.(package private) void
clearStatus(java.lang.String service)
(package private) void
enterTerminalState()
private static HealthCheckResponse
getResponseForWatch(HealthCheckResponse.ServingStatus recordedStatus)
private void
notifyWatchers(java.lang.String service, HealthCheckResponse.ServingStatus status)
(package private) int
numWatchersForTest(java.lang.String service)
(package private) void
setStatus(java.lang.String service, HealthCheckResponse.ServingStatus status)
private void
setStatusInternal(java.lang.String service, HealthCheckResponse.ServingStatus status)
void
watch(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver)
Performs a watch for the serving status of the requested service.-
Methods inherited from class io.grpc.health.v1.HealthGrpc.HealthImplBase
bindService
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
statusMap
private final java.util.Map<java.lang.String,HealthCheckResponse.ServingStatus> statusMap
-
watchLock
private final java.lang.Object watchLock
-
terminal
private boolean terminal
-
watchers
private final java.util.HashMap<java.lang.String,java.util.IdentityHashMap<StreamObserver<HealthCheckResponse>,java.lang.Boolean>> watchers
-
-
Method Detail
-
check
public void check(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver)
Description copied from interface:HealthGrpc.AsyncService
If the requested service is unknown, the call will fail with status NOT_FOUND.
-
watch
public void watch(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver)
Description copied from interface:HealthGrpc.AsyncService
Performs a watch for the serving status of the requested service. The server will immediately send back a message indicating the current serving status. It will then subsequently send a new message whenever the service's serving status changes. If the requested service is unknown when the call is received, the server will send a message setting the serving status to SERVICE_UNKNOWN but will *not* terminate the call. If at some future point, the serving status of the service becomes known, the server will send a new message with the service's serving status. If the call terminates with status UNIMPLEMENTED, then clients should assume this method is not supported and should not retry the call. If the call terminates with any other status (including OK), clients should retry the call with appropriate exponential backoff.
-
setStatus
void setStatus(java.lang.String service, HealthCheckResponse.ServingStatus status)
-
setStatusInternal
private void setStatusInternal(java.lang.String service, HealthCheckResponse.ServingStatus status)
-
clearStatus
void clearStatus(java.lang.String service)
-
enterTerminalState
void enterTerminalState()
-
numWatchersForTest
int numWatchersForTest(java.lang.String service)
-
notifyWatchers
private void notifyWatchers(java.lang.String service, @Nullable HealthCheckResponse.ServingStatus status)
-
getResponseForWatch
private static HealthCheckResponse getResponseForWatch(@Nullable HealthCheckResponse.ServingStatus recordedStatus)
-
-