viirya commented on code in PR #48923:
URL: https://github.com/apache/spark/pull/48923#discussion_r1852722004


##########
core/src/main/scala/org/apache/spark/deploy/rest/RestSubmissionServer.scala:
##########
@@ -92,6 +94,12 @@ private[spark] abstract class RestSubmissionServer(
    */
   private def doStart(startPort: Int): (Server, Int) = {
     val threadPool = new QueuedThreadPool
+    if (Utils.isJavaVersionAtLeast21 && 
masterConf.get(MASTER_REST_SERVER_VIRTUAL_THREADS)) {
+      val newVirtualThreadPerTaskExecutor =
+        classOf[Executors].getMethod("newVirtualThreadPerTaskExecutor")
+      val service = 
newVirtualThreadPerTaskExecutor.invoke(null).asInstanceOf[ExecutorService]
+      threadPool.setVirtualThreadsExecutor(service)

Review Comment:
   The thread number configured for the `threadPool` also determines the number 
of virtual threads?



##########
core/src/main/scala/org/apache/spark/deploy/rest/RestSubmissionServer.scala:
##########
@@ -92,6 +94,12 @@ private[spark] abstract class RestSubmissionServer(
    */
   private def doStart(startPort: Int): (Server, Int) = {
     val threadPool = new QueuedThreadPool
+    if (Utils.isJavaVersionAtLeast21 && 
masterConf.get(MASTER_REST_SERVER_VIRTUAL_THREADS)) {
+      val newVirtualThreadPerTaskExecutor =
+        classOf[Executors].getMethod("newVirtualThreadPerTaskExecutor")
+      val service = 
newVirtualThreadPerTaskExecutor.invoke(null).asInstanceOf[ExecutorService]
+      threadPool.setVirtualThreadsExecutor(service)

Review Comment:
   For example https://github.com/apache/spark/pull/48921.



-- 
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]

Reply via email to