MCPcopy
hub / github.com/IBM/sarama / borrow

Method borrow

examples/txn_producer/main.go:193–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

191}
192
193func (p *producerProvider) borrow() (producer sarama.AsyncProducer) {
194 p.producersLock.Lock()
195 defer p.producersLock.Unlock()
196
197 if len(p.producers) == 0 {
198 for {
199 producer = p.producerProvider()
200 if producer != nil {
201 return
202 }
203 }
204 }
205
206 index := len(p.producers) - 1
207 producer = p.producers[index]
208 p.producers = p.producers[:index]
209 return
210}
211
212func (p *producerProvider) release(producer sarama.AsyncProducer) {
213 p.producersLock.Lock()

Callers 1

produceTestRecordFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected