zeroturnaround / zt-exec

ZeroTurnaround Process Executor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use custom executor service in a thread-controlled environment

Brico87 opened this issue · comments

In a thread-controlled environment, it could be great to provide our own ExecutorService instance in order to keep control over the thread pool instead of automatically instantiating a new newSingleThreadScheduledExecutor everytime we want to execute a command.

In the class ProcessExecutor, what do you think if we could have the possibility to do the following:

public StartedProcess start(ExecutorService providedService) throws IOException {
    WaitForProcess task = startInternal();
    ExecutorService service;
    if (providedService == null) {
        service = newExecutor(task);
    } else {
        service = providedService;
    }
    Future<ProcessResult> future = invokeSubmit(service, task);

This is not an issue but for us it appears as a limitation of the ProcessExecutor class.

Would you be willing to send a pull request?
(Sorry for the long delay, I'm taking over maintenance of this project so communication should be faster from now on)