MCPcopy
hub / github.com/grpc/grpc-go / close

Method close

balancer_wrapper.go:155–168  ·  balancer_wrapper.go::ccBalancerWrapper.close

close initiates async shutdown of the wrapper. cc.mu must be held when calling this function. To determine the wrapper has finished shutting down, the channel should block on ccb.serializer.Done() without cc.mu held.

()

Source from the content-addressed store, hash-verified

153// calling this function. To determine the wrapper has finished shutting down,
154// the channel should block on ccb.serializer.Done() without cc.mu held.
155func (ccb *ccBalancerWrapper) close() {
156 ccb.mu.Lock()
157 ccb.closed = true
158 ccb.mu.Unlock()
159 channelz.Info(logger, ccb.cc.channelz, "ccBalancerWrapper: closing")
160 ccb.serializer.TrySchedule(func(context.Context) {
161 if ccb.balancer == nil {
162 return
163 }
164 ccb.balancer.Close()
165 ccb.balancer = nil
166 })
167 ccb.serializerCancel()
168}
169
170// exitIdle invokes the balancer's exitIdle method in the serializer.
171func (ccb *ccBalancerWrapper) exitIdle() {

Callers 2

GetOrBuildProducerMethod · 0.45
closeProducersMethod · 0.45

Calls 5

InfoFunction · 0.92
CloseMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
TryScheduleMethod · 0.45

Tested by

no test coverage detected