Build constructs and returns a producer and its cleanup function
(cci any)
| 38 | |
| 39 | // Build constructs and returns a producer and its cleanup function |
| 40 | func (*producerBuilder) Build(cci any) (balancer.Producer, func()) { |
| 41 | p := &producer{ |
| 42 | client: v3orcaservicegrpc.NewOpenRcaServiceClient(cci.(grpc.ClientConnInterface)), |
| 43 | intervals: make(map[time.Duration]int), |
| 44 | listeners: make(map[OOBListener]struct{}), |
| 45 | backoff: internal.DefaultBackoffFunc, |
| 46 | } |
| 47 | return p, func() { |
| 48 | p.mu.Lock() |
| 49 | if p.stop != nil { |
| 50 | p.stop() |
| 51 | p.stop = nil |
| 52 | } |
| 53 | p.mu.Unlock() |
| 54 | <-p.stopped |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | var producerBuilderSingleton = &producerBuilder{} |
| 59 |