-
Notifications
You must be signed in to change notification settings - Fork 13
[401] stop piper thread via flag #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't add line comments because the lines I want to comment on are unmodified:
For:
final Runnable c = cancelation[0];
if ((c != null)) {
synchronized (c) {
c.notify();
}
}
I don't think this is needed anymore as I don't think anything is waiting on Runnable c. Once you do that, I think a bit of simplification is trivally possible as final Runnable[] cancelation
is no longer needed and the method can just return stopper
.
For:
} catch (Throwable t) {
throw sneakyThrow(t);
}
I think this needs to check for stop and suppress the exception if stop is requested. This is because at the point that stop is requested the code may be either inside of the read() call or just after you checked for stop but before read is called. In that case you want to suppress the now expected exception. E.g:
} catch (Throwable t) {
if (!stop.get()) {
throw sneakyThrow(t);
}
}
This structure I am recommending here is based on OutputStremMonitor (link to it's catch block)
@@ -65,8 +65,8 @@ protected ProcessBuilder createProcessBuilder() { | |||
public void start() throws IOException { | |||
super.start(); | |||
if (logEnabled() && getLogProvider().isPresent()) { | |||
errorStreamPipeStopper = new AsyncStreamPipe().pipeTo(new BufferedInputStream(getErrorStream()), | |||
getLogProvider().get().getOutputStream()); | |||
errorStreamPipeStopper = new AsyncStreamPipe().pipeTo("LS stderr pipe", //$NON-NLS-1$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you added a thread name. Can you mention CDT in it?
errorStreamPipeStopper = new AsyncStreamPipe().pipeTo("LS stderr pipe", //$NON-NLS-1$ | |
errorStreamPipeStopper = new AsyncStreamPipe().pipeTo("CDT LS stderr pipe", //$NON-NLS-1$ |
I think I fixed all issues mentioned above |
There is a small amount of dead code still in this patchset hidden by the |
fixes #401