Interface ChannelEndpoint (6.118.0)

public interface ChannelEndpoint

Represents a Spanner server endpoint for location-aware routing.

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: ChannelEndpointCache

Methods

decrementActiveRequests()

public abstract void decrementActiveRequests()

Records that an application RPC finished on this endpoint.

Implementations must not allow the count to go negative.

getActiveRequestCount()

public abstract int getActiveRequestCount()

Returns the number of currently active application RPCs on this endpoint.

Returns
Type Description
int

getAddress()

public abstract String getAddress()

Returns the network address of this server.

Returns
Type Description
String

the server address in "host:port" format

getChannel()

public abstract ManagedChannel getChannel()

Returns the gRPC channel for making RPCs to this server.

The returned channel is managed by the ChannelEndpointCache and should not be shut down directly by callers.

Returns
Type Description
io.grpc.ManagedChannel

the managed channel for this server

incrementActiveRequests()

public abstract 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.

isHealthy()

public abstract boolean isHealthy()

Returns whether this server's channel is in READY state and can accept location-aware RPCs.

Only endpoints in READY state are eligible for location-aware routing. Endpoints in IDLE, CONNECTING, TRANSIENT_FAILURE, or SHUTDOWN are not considered healthy for location-aware routing purposes.

Returns
Type Description
boolean

true if the channel is in READY state

isTransientFailure()

public abstract boolean isTransientFailure()

Returns whether this server's channel is in TRANSIENT_FAILURE state.

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
Type Description
boolean

true if the channel is in TRANSIENT_FAILURE state