This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 60e4ab12185 HDDS-14710. Intermittent "Socket closed" in JacocoServer 
(#9824)
60e4ab12185 is described below

commit 60e4ab121853c182e1272b04fd1a93d55b12cfc7
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Feb 26 16:56:24 2026 +0100

    HDDS-14710. Intermittent "Socket closed" in JacocoServer (#9824)
---
 .../src/main/java/org/apache/ozone/test/JacocoServer.java   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/JacocoServer.java 
b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/JacocoServer.java
index 51e74690700..2b7c997a350 100644
--- 
a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/JacocoServer.java
+++ 
b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/JacocoServer.java
@@ -42,7 +42,6 @@ public final class JacocoServer {
   private JacocoServer() {
   }
 
-  @SuppressWarnings("checkstyle:EmptyStatement")
   public static void main(String[] args) throws IOException {
     ExecutionDataWriter destination =
         new 
ExecutionDataWriter(Files.newOutputStream(Paths.get(destinationFile)));
@@ -56,7 +55,15 @@ public static void main(String[] args) throws IOException {
       }
     }));
 
-    while (true) {
+    try {
+      acceptConnections(serverSocket, destination);
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+
+  private static void acceptConnections(ServerSocket serverSocket, 
ExecutionDataWriter destination) throws IOException {
+    while (!serverSocket.isClosed()) {
       final Socket socket = serverSocket.accept();
       new Thread(() -> {
         try {
@@ -69,7 +76,7 @@ public static void main(String[] args) throws IOException {
           reader.setExecutionDataVisitor(
               synchronizedCall(destination::visitClassExecution));
           while (reader.read()) {
-            ;//read until the end of the stream.
+            Thread.yield();
           }
           synchronized (lockMonitor) {
             destination.flush();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to