Interface ChannelEndpoint
Each instance wraps a gRPC ManagedChannel connected to a specific Spanner server. The
ChannelEndpointCache creates and caches these instances.
Implementations must be thread-safe as instances may be shared across multiple concurrent operations.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidRecords that an application RPC finished on this endpoint.intReturns the number of currently active application RPCs on this endpoint.Returns the network address of this server.io.grpc.ManagedChannelReturns the gRPC channel for making RPCs to this server.voidRecords that an application RPC started on this endpoint.booleanReturns whether this server's channel is inREADYstate and can accept location-aware RPCs.booleanReturns whether this server's channel is inTRANSIENT_FAILUREstate.
-
Method Details
-
getAddress
String getAddress()Returns the network address of this server.- Returns:
- the server address in "host:port" format
-
isHealthy
boolean isHealthy()Returns whether this server's channel is inREADYstate and can accept location-aware RPCs.Only endpoints in
READYstate are eligible for location-aware routing. Endpoints inIDLE,CONNECTING,TRANSIENT_FAILURE, orSHUTDOWNare not considered healthy for location-aware routing purposes.- Returns:
- true if the channel is in READY state
-
isTransientFailure
boolean isTransientFailure()Returns whether this server's channel is inTRANSIENT_FAILUREstate.When an endpoint is in transient failure, it should be reported as a skipped tablet in routing hints so the server can refresh the client cache.
- Returns:
- true if the channel is in TRANSIENT_FAILURE state
-
getChannel
io.grpc.ManagedChannel getChannel()Returns the gRPC channel for making RPCs to this server.The returned channel is managed by the
ChannelEndpointCacheand should not be shut down directly by callers.- Returns:
- the managed channel for this server
-
incrementActiveRequests
void incrementActiveRequests()Records that an application RPC started on this endpoint.This is used for request-load-aware routing decisions. Implementations must keep the count scoped to this endpoint instance so evicted or recreated endpoints do not share inflight state.
-
decrementActiveRequests
void decrementActiveRequests()Records that an application RPC finished on this endpoint.Implementations must not allow the count to go negative.
-
getActiveRequestCount
int getActiveRequestCount()Returns the number of currently active application RPCs on this endpoint.
-