commit e8c69d6fe94195aa2c0f1331b18c235d3004fee7
parent 7d8cbd61d27d2bcc9b385f3796f59b8362540cea
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date: Sun, 24 Nov 2019 18:05:55 +0100
Use SingleThreadExecutor instead of wasteful FixedThreadPool
Only 2 threads are required; one for main and the other for clienttask
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client.java b/client.java
@@ -11,7 +11,7 @@ public class client {
String ip = "127.0.0.1";
Socket connection;
- ExecutorService exec = Executors.newFixedThreadPool(5);
+ ExecutorService exec = Executors.newSingleThreadExecutor();
try {
connection = new Socket(ip, port);