Skip to content

Commit

Permalink
Use new socket for each source file
Browse files Browse the repository at this point in the history
As a workaround for the issue we have with the JS process returning the LST for a previously parsed source file, the Java parser frontend now creates a new socket for each source file being parsed.
  • Loading branch information
knutwannheden committed Nov 28, 2024
1 parent 86dc378 commit 1ab9932
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public Stream<SourceFile> parseInputs(Iterable<Input> inputs, @Nullable Path rel
assert client != null;
assert remotingContext != null;
try (EncodingDetectingInputStream is = input.getSource(ctx)) {
SourceFile parsed = client.runUsingSocket((socket, messenger) -> requireNonNull(messenger.sendRequest(generator -> {
SourceFile parsed = client.withNewSocket((socket, messenger) -> requireNonNull(messenger.sendRequest(generator -> {
if (input.isSynthetic() || !Files.isRegularFile(input.getPath())) {
generator.writeString("parse-source");
generator.writeString(is.readFully());
Expand All @@ -109,7 +109,6 @@ public Stream<SourceFile> parseInputs(Iterable<Input> inputs, @Nullable Path rel
Tree tree = RemotingMessenger.receiveTree(remotingContext, parser,null);
return (SourceFile) tree;
}, socket)))
.withSourcePath(path)
.withFileAttributes(FileAttributes.fromPath(input.getPath()))
.withCharset(getCharset(ctx));

Expand Down

0 comments on commit 1ab9932

Please sign in to comment.