You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2019/11/09 03:32:16 UTC
[maven-surefire] branch maven2surefire-jvm-communication updated:
set server socket options
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 95f93bf set server socket options
95f93bf is described below
commit 95f93bf48b3954aaeac4ff3a58394db673470cc9
Author: tibordigana <ti...@apache.org>
AuthorDate: Sat Nov 9 04:32:08 2019 +0100
set server socket options
---
.../maven/plugin/surefire/extensions/SurefireForkChannel.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java
index fe5e2a2..fb8f789 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java
@@ -29,6 +29,9 @@ import java.nio.channels.AsynchronousServerSocketChannel;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import static java.net.StandardSocketOptions.SO_KEEPALIVE;
+import static java.net.StandardSocketOptions.SO_REUSEADDR;
+import static java.net.StandardSocketOptions.TCP_NODELAY;
import static java.nio.channels.AsynchronousChannelGroup.withThreadPool;
import static java.nio.channels.AsynchronousServerSocketChannel.open;
import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThreadFactory;
@@ -45,8 +48,11 @@ final class SurefireForkChannel implements ForkChannel
SurefireForkChannel() throws IOException
{
executorService = Executors.newCachedThreadPool( newDaemonThreadFactory() );
- server = open( withThreadPool( executorService ) )
- .bind( new InetSocketAddress( 0 ) );
+ server = open( withThreadPool( executorService ) );
+ server.setOption( SO_REUSEADDR, true );
+ server.setOption( TCP_NODELAY, true );
+ server.setOption( SO_KEEPALIVE, true );
+ server.bind( new InetSocketAddress( 0 ) );
serverPort = ( (InetSocketAddress) server.getLocalAddress() ).getPort();
}