Skip to content

Commit

Permalink
Move WorkRequestHandler from build jar to Worker package. This is par…
Browse files Browse the repository at this point in the history
…t of the cleanup associated with enabling JSON workers.

RELNOTES: None.
PiperOrigin-RevId: 340548070
  • Loading branch information
susinmotion authored and copybara-github committed Nov 4, 2020
1 parent 0f00b5b commit 5c8e584
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ java_library(
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/plugins:errorprone",
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/plugins:processing",
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/statistics",
"//src/main/protobuf:worker_protocol_java_proto",
"//src/main/java/com/google/devtools/build/lib/worker:work_request_handlers",
"//third_party:guava",
"//third_party:jsr305",
"//third_party/java/jacoco:core",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.devtools.build.buildjar.javac.plugins.BlazeJavaCompilerPlugin;
import com.google.devtools.build.buildjar.javac.plugins.dependency.DependencyModule;
import com.google.devtools.build.buildjar.javac.plugins.errorprone.ErrorPronePlugin;
import com.google.devtools.build.lib.worker.WorkRequestHandler;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,3 @@ java_test(
"//third_party:truth",
],
)

java_test(
name = "WorkRequestHandlerTest",
srcs = ["WorkRequestHandlerTest.java"],
deps = [
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar",
"//src/main/protobuf:worker_protocol_java_proto",
"//third_party:junit4",
"//third_party:mockito",
"//third_party:truth",
],
)
11 changes: 11 additions & 0 deletions src/main/java/com/google/devtools/build/lib/worker/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,14 @@ java_library(
"//third_party/protobuf:protobuf_java_util",
],
)

java_library(
name = "work_request_handlers",
srcs = [
"WorkRequestHandler.java",
],
deps = [
"//src/main/protobuf:worker_protocol_java_proto",
"//third_party:guava",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.buildjar;
package com.google.devtools.build.lib.worker;

import com.google.common.annotations.VisibleForTesting;
import com.google.devtools.build.lib.worker.WorkerProtocol.WorkRequest;
Expand Down Expand Up @@ -114,6 +114,9 @@ void respondToRequest(WorkRequest request, PrintStream out) throws IOException {
}
out.flush();

// This would be a tempting place to suggest a GC, but it causes a 10% performance hit.
// Hint to the system that now would be a good time to run a gc. After a compile
// completes lots of objects should be available for collection and it should be cheap to
// collect them.
System.gc();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.devtools.build.buildjar;
package com.google.devtools.build.lib.worker;

import static com.google.common.truth.Truth.assertThat;

Expand Down

0 comments on commit 5c8e584

Please sign in to comment.