Skip to content

Conversation

testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Mar 13, 2019

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
@testforstephen testforstephen requested review from yaohaizh, andxu, Eskibear and akaroml and removed request for yaohaizh, andxu and Eskibear March 13, 2019 08:52
Copy link
Member

@akaroml akaroml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is to only keep the part that generates the source info. The stream related changes need to revisited from solution perspective.

@@ -100,6 +100,8 @@ public void run() {
} catch (IOException e) {
logger.log(Level.SEVERE, String.format("Read data from io exception: %s", e.toString()), e);
}

requestSubject.onComplete();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we didn't call this before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't call onComplete(), the new thread created by RXJava will never die. There will be lots of RXJava threads alive after running the debug session multiple times.

null,
null
};
Pattern stacktracePattern = Pattern.compile("\\s+at\\s+(([\\w$]+\\.)*[\\w$]+)\\(([\\w-$]+\\.java:\\d+)\\)");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the launcher's responsibility to process the stack trace?

I would suggest that we have a dedicated place to host such logic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern object could be stateful. Please double check the behavior by processing multiple stacktraces in the same debug session.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

Pattern is unstateful, all state is saved in Matcher, so multiple Matchers can share the same pattern instance.


/**
* constructor.
*/
public ProcessConsole(Process process) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I got the whole point now. You are merging two streams. This can be done by simply calling Observable.mergeWith. It's the consumers' choice to merge those streams together. The underlying provider should keep it clean and simple.

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
*/
public Observable<ConsoleMessage> lineMessages() {
return this.messages().map((message) -> {
String[] lines = message.output.split("(?<=\n)");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the mean of (?<=\n)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a positive lookbehind regex. Able to split lines and keep delimiter.

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
@testforstephen testforstephen dismissed akaroml’s stale review April 12, 2019 06:34

The requested review comments are addressed in the new update.

@testforstephen testforstephen merged commit bfcf63f into master Apr 12, 2019
@testforstephen testforstephen deleted the jinbo_stackjump branch April 12, 2019 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jump to source when clicking the call stack info in debug console Add Exception url to click open java file
3 participants