pan3793 commented on a change in pull request #1312:
URL: https://github.com/apache/incubator-kyuubi/pull/1312#discussion_r738928938



##########
File path: 
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/KyuubiOperation.scala
##########
@@ -86,27 +87,37 @@ abstract class KyuubiOperation(
     }
   }
 
-  override def cancel(): Unit = {
-    if (_remoteOpHandle != null && !isClosedOrCanceled) {
-      try {
-        client.cancelOperation(_remoteOpHandle)
-        setState(OperationState.CANCELED)
-      } catch onError("cancelling")
+  override def cancel(): Unit = state.synchronized {
+    if (!isClosedOrCanceled) {
+      setState(OperationState.CANCELED)
+      if (_remoteOpHandle != null) {

Review comment:
       As `remoteOpHanlde` is optional, can we use `Option` to represent it 
instead of `null` testing?




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