Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/org/rascalmpl/dap/DebugSocketServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
*/
package org.rascalmpl.dap;

import engineering.swat.watch.DaemonThreadPool;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.checkerframework.checker.nullness.qual.Nullable;
import org.eclipse.lsp4j.debug.TerminatedEventArguments;
Expand Down Expand Up @@ -67,7 +67,7 @@ private void startListening(Evaluator evaluator){
Socket newClient = serverSocket.accept();
if(clientSocket == null || clientSocket.isClosed()){
clientSocket = newClient;
threadPool = Executors.newCachedThreadPool();
threadPool = DaemonThreadPool.buildConstrainedCached("rascal-debug", Math.max(2, Math.min(6, Runtime.getRuntime().availableProcessors() - 2)));
debugClient = RascalDebugAdapterLauncher.start(evaluator, clientSocket, this, services, threadPool);
} else {
newClient.close();
Expand Down
3 changes: 2 additions & 1 deletion src/org/rascalmpl/ideservices/RemoteIDEServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
*/
package org.rascalmpl.ideservices;

import engineering.swat.watch.DaemonThreadPool;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.eclipse.lsp4j.jsonrpc.Launcher;
import org.jline.terminal.Terminal;
import org.rascalmpl.debug.IRascalMonitor;
Expand Down Expand Up @@ -65,6 +65,7 @@ public RemoteIDEServices(int ideServicesPort, PrintWriter stderr, IRascalMonitor
.setInput(socket.getInputStream())
.setOutput(socket.getOutputStream())
.configureGson(GsonUtils::configureGson)
.setExecutorService(DaemonThreadPool.buildConstrainedCached("rascal-ide-services", Math.max(2, Math.min(6, Runtime.getRuntime().availableProcessors() - 2))))
.create();

clientLauncher.startListening();
Expand Down
5 changes: 2 additions & 3 deletions src/org/rascalmpl/shell/RascalCompile.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package org.rascalmpl.shell;

import engineering.swat.watch.DaemonThreadPool;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.nio.file.Files;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.function.Consumer;
import java.util.function.Function;
Expand Down Expand Up @@ -120,7 +119,7 @@ private static int parallelMain(Map<String, IValue> parsedArgs, IList preChecks,

// a cachedThreadPool lazily spins-up threads, but eagerly cleans them up
// this might help with left-over threads to get more memory and finish sooner.
final ExecutorService exec = Executors.newCachedThreadPool();
final ExecutorService exec = DaemonThreadPool.buildConstrainedCached("rascal-compile", parAmount);

// the for loop eagerly spawns `parAmount` workers, one for each chunk
List<Future<Integer>> workers = new ArrayList<>(parAmount);
Expand Down
Loading