http urls monitor.

executor.go 613B

123456789101112131415
  1. package concurrent
  2. import "context"
  3. // Executor replace go keyword to start a new goroutine
  4. // the goroutine should cancel itself if the context passed in has been cancelled
  5. // the goroutine started by the executor, is owned by the executor
  6. // we can cancel all executors owned by the executor just by stop the executor itself
  7. // however Executor interface does not Stop method, the one starting and owning executor
  8. // should use the concrete type of executor, instead of this interface.
  9. type Executor interface {
  10. // Go starts a new goroutine controlled by the context
  11. Go(handler func(ctx context.Context))
  12. }