yaooqinn commented on code in PR #4739:
URL: https://github.com/apache/kyuubi/pull/4739#discussion_r1172271446


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/operation/AbstractOperation.scala:
##########
@@ -45,7 +46,16 @@ abstract class AbstractOperation(session: Session) extends 
Operation with Loggin
 
   private var statementTimeoutCleaner: Option[ScheduledExecutorService] = None
 
-  protected def cleanup(targetState: OperationState): Unit = 
state.synchronized {
+  private val lock: ReentrantLock = new ReentrantLock()
+
+  protected def withLockRequired[T](block: => T): T = {
+    try {
+      lock.lock()
+      block
+    } finally lock.unlock()
+  }
+

Review Comment:
   Can we place it in Utils?



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