[maven-surefire] branch maven2surefire-jvm-communication updated: simplified writes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-surefire] branch maven2surefire-jvm-communication updated: simplified writes

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

tibordigana pushed a commit to branch maven2surefire-jvm-communication
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/maven2surefire-jvm-communication by this push:
     new c121165  simplified writes
c121165 is described below

commit c1211651bc51f94c375d50c27b5ea1f9f41ba924
Author: tibordigana <[hidden email]>
AuthorDate: Sat Nov 9 03:58:22 2019 +0100

    simplified writes
---
 .../plugin/surefire/extensions/NetworkingProcessExecutor.java     | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/NetworkingProcessExecutor.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/NetworkingProcessExecutor.java
index c04f972..8e8b7d7 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/NetworkingProcessExecutor.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/NetworkingProcessExecutor.java
@@ -40,7 +40,6 @@ import java.util.Scanner;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
 
 import static java.nio.ByteBuffer.wrap;
 import static java.nio.charset.StandardCharsets.US_ASCII;
@@ -120,14 +119,11 @@ final class NetworkingProcessExecutor implements ExecutableCommandline
                                 MasterProcessCommand cmdType = cmd.getCommandType();
                                 byte[] b = cmdType.hasDataType() ? cmdType.encode( cmd.getData() ) : cmdType.encode();
                                 ByteBuffer bb = wrap( b );
-                                int writtenBytesTotal = 0;
                                 do
                                 {
-                                    Future<Integer> writtenBytes = client.write( bb );
-                                    int writtenCount = writtenBytes.get();
-                                    writtenBytesTotal += writtenCount;
+                                    client.write( bb ).get();
                                 }
-                                while ( writtenBytesTotal < bb.limit() );
+                                while ( bb.hasRemaining() );
                             }
                         }
                         catch ( Exception e )