From 0cfe7589244bb3b283b88704860c5f167c9d5e17 Mon Sep 17 00:00:00 2001 From: Gilles Querret Date: Fri, 24 Mar 2023 14:15:26 +0100 Subject: [PATCH] Only one ServerSocket.accept() in parallel ! Issue #504 --- src/java/com/phenix/pct/PCTBgRun.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/java/com/phenix/pct/PCTBgRun.java b/src/java/com/phenix/pct/PCTBgRun.java index 02721e5ec..4a890ebce 100644 --- a/src/java/com/phenix/pct/PCTBgRun.java +++ b/src/java/com/phenix/pct/PCTBgRun.java @@ -662,14 +662,15 @@ public int getLocalPort() { public void run() { ExecutorService group = Executors.newFixedThreadPool(numThreads); for (int zz = 0; zz < numThreads; zz++) { + final Socket socket; + try { + socket = server.accept(); + } catch (IOException caught) { + setBuildException(caught); + return; + } + group.execute(() -> { - final Socket socket; - try { - socket = server.accept(); - } catch (IOException caught) { - setBuildException(caught); - return; - } final BackgroundWorker status = createOpenEdgeWorker(socket); status.setDBConnections(options.getDBConnections().iterator()); status.setAliases(options.getAliases().iterator());