LuciferYang commented on code in PR #44718:
URL: https://github.com/apache/spark/pull/44718#discussion_r1459073865
##########
launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java:
##########
@@ -128,7 +125,8 @@ private LauncherServer() throws IOException {
this.threadIds = new AtomicLong();
this.factory = new NamedThreadFactory(THREAD_NAME_FMT);
this.secretToPendingApps = new ConcurrentHashMap<>();
- this.timeoutTimer = new Timer("LauncherServer-TimeoutTimer", true);
+ this.timeoutTimer = new ScheduledThreadPoolExecutor(
+ 1, new NamedThreadFactory("LauncherServer-TimeoutTimer"));
Review Comment:
nit: Indentation
##########
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala:
##########
@@ -963,8 +964,8 @@ private[spark] class TaskSchedulerImpl(
barrierCoordinator.stop()
}
}
- starvationTimer.cancel()
- abortTimer.cancel()
+ starvationTimer.shutdown()
+ abortTimer.shutdown()
Review Comment:
It's fine, but would it be more appropriate to use `ThreadUtils.shutdown`? I
am not sure.
##########
launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java:
##########
@@ -27,11 +27,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Timer;
import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.*;
Review Comment:
I tend to avoid using `import *`
##########
launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java:
##########
@@ -27,11 +27,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Timer;
import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.*;
Review Comment:
```suggestion
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]