code: func (cms *ConcurrentMergeScheduler) worker(id int) {
  	atomic.AddInt32(&cms.numMergeRoutines, 1)
  	fmt.Printf("CMS Worker %v is started.\n", id)
  	var isRunning = true
  	var wg *sync.WaitGroup
  	for isRunning && id < cms.maxRoutineCount {
  		select {
  		case job := <-cms.chRequest:
  			cms.process(job)
  		case wg = <-cms.chSync:
  			isRunning = false
  			defer wg.Done()
  		}
  	}
  	fmt.Printf("CMS Worker %v is stopped.\n", id)
  	atomic.AddInt32(&cms.numMergeRoutines, -1)
  }
docs: /*
  Daemon worker that accepts and processes merge job.
  
  GoLucene assumes each merge is pre-sorted according to its merge size
  before acquired from IndexWriter. It makes use of pre-allocated
  go routines, instead of MergeThread to do the real merge work,
  witout explicit synchronizations and waitings.
  
  Note, however, change of merge count won't pause/resume workers.
  */