Killing a driver handle is retried with an exponential backoff

This commit is contained in:
Alex Dadgar
2016-02-16 21:00:49 -08:00
parent 6752e36683
commit f1c80afcf3
6 changed files with 101 additions and 15 deletions

View File

@@ -282,12 +282,25 @@ func (h *javaHandle) Update(task *structs.Task) error {
}
func (h *javaHandle) Kill() error {
h.executor.ShutDown()
if err := h.executor.ShutDown(); err != nil {
if h.pluginClient.Exited() {
return nil
}
return fmt.Errorf("executor Shutdown failed: %v", err)
}
select {
case <-h.doneCh:
return nil
case <-time.After(h.killTimeout):
return h.executor.Exit()
if h.pluginClient.Exited() {
return nil
}
if err := h.executor.Exit(); err != nil {
return fmt.Errorf("executor Exit failed: %v", err)
}
return nil
}
}