diff --git a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java index 570530d7028..ef8a481315a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java @@ -22,6 +22,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +/* + * =========================================================================== + * (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved + * =========================================================================== + */ package com.sun.tools.sjavac.client; @@ -84,6 +89,8 @@ public class SjavacClient implements Sjavac { // Store the server conf settings here. private final String settings; + + private boolean isRiscv = System.getProperty("os.arch").toLowerCase().contains("riscv"); public SjavacClient(Options options) { String tmpServerConf = options.getServerConf(); @@ -183,10 +190,15 @@ private Socket tryConnect() throws IOException, InterruptedException { try { return makeConnectionAttempt(); } catch (IOException ex) { - Log.error("Connection attempt failed: " + ex.getMessage()); - if (attempt >= MAX_CONNECT_ATTEMPTS) { - Log.error("Giving up"); - throw new IOException("Could not connect to server", ex); + /* Keep trying to connect as the native compilation with a non-JIT cross build + * on Linux/RISCV is extremely slow. + */ + if (!isRiscv) { + Log.error("Connection attempt failed: " + ex.getMessage()); + if (attempt >= MAX_CONNECT_ATTEMPTS) { + Log.error("Giving up"); + throw new IOException("Could not connect to server", ex); + } } } Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java index 3bbdca22c4e..6ffbb15dbb0 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java @@ -22,6 +22,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +/* + * =========================================================================== + * (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved + * =========================================================================== + */ package com.sun.tools.sjavac.server; @@ -76,6 +81,7 @@ public class PortFile { private long serverCookie; private int myServerPort; private long myServerCookie; + private boolean isRiscv = System.getProperty("os.arch").toLowerCase().contains("riscv"); /** * Create a new portfile. @@ -247,7 +253,11 @@ public void waitForValidValues() throws IOException, InterruptedException { Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms"); return; } - if (System.currentTimeMillis() > timeout) { + + /* Keep waiting for port file values as the native compilation with a non-JIT cross build + * on Linux/RISCV is extremely slow. + */ + if (!isRiscv && (System.currentTimeMillis() > timeout)) { break; } Thread.sleep(MS_BETWEEN_ATTEMPTS);