Hooking up the executor in all drivers

This commit is contained in:
Diptanu Choudhury
2016-03-23 13:19:45 -07:00
parent 5568258d0a
commit 701a1bd9bc
8 changed files with 43 additions and 788 deletions

View File

@@ -194,7 +194,9 @@ func (d *JavaDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle,
doneCh: make(chan struct{}),
waitCh: make(chan *cstructs.WaitResult, 1),
}
if err := h.executor.RegisterServices(); err != nil {
d.logger.Printf("[ERR] driver.java: error registering services with consul for task: %v", task)
}
go h.run()
return h, nil
}
@@ -340,6 +342,12 @@ func (h *javaHandle) run() {
}
h.waitCh <- &cstructs.WaitResult{ExitCode: ps.ExitCode, Signal: 0, Err: err}
close(h.waitCh)
// Remove services
if err := h.executor.DeregisterServices(); err != nil {
h.logger.Printf("[ERR] driver.java: failed to kill the deregister services: %v", err)
}
h.executor.Exit()
h.pluginClient.Kill()
}