ulysses-you commented on a change in pull request #1328:
URL: https://github.com/apache/incubator-kyuubi/pull/1328#discussion_r742473850



##########
File path: 
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecuteStatement.scala
##########
@@ -164,22 +170,15 @@ class ExecuteStatement(
   }
 
   override protected def runInternal(): Unit = {
-    if (shouldRunAsync) {
-      executeStatement()
-      val sessionManager = session.sessionManager
-      val asyncOperation = new Runnable {
-        override def run(): Unit = waitStatementComplete()
-      }
-      try {
-        val backgroundOperation =
-          sessionManager.submitBackgroundOperation(asyncOperation)
-        setBackgroundHandle(backgroundOperation)
-      } catch onError("submitting query in background, query rejected")
-    } else {
-      setState(OperationState.RUNNING)
-      executeStatement()
-      setState(OperationState.FINISHED)
-    }
+    executeStatement()
+    val sessionManager = session.sessionManager
+    val asyncOperation: Runnable = () => waitStatementComplete()
+    try {
+      val opHandle = sessionManager.submitBackgroundOperation(asyncOperation)

Review comment:
       can't we use the returned `futrue` directly rather than add a 
`CountDownLatch` ?
   ```
   backgroundOperation.get(timeout)
   ```




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


Reply via email to