Shutdown waits for the Runtime to stop.
()
| 264 | |
| 265 | // Shutdown waits for the Runtime to stop. |
| 266 | func (r *Runtime) Shutdown() (err error) { |
| 267 | if !atomic.CompareAndSwapUint32(&r.started, 1, 2) { |
| 268 | return |
| 269 | } |
| 270 | |
| 271 | select { |
| 272 | case <-r.stopCh: |
| 273 | default: |
| 274 | close(r.stopCh) |
| 275 | } |
| 276 | r.wg.Wait() |
| 277 | |
| 278 | return |
| 279 | } |
| 280 | |
| 281 | // Apply defines entry for Leader node. |
| 282 | func (r *Runtime) Apply(ctx context.Context, req interface{}) (result interface{}, logIndex uint64, err error) { |