File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
kyuubi-common/src/main/scala/org/apache/kyuubi/operation
kyuubi-server/src/main/scala/org/apache/kyuubi/operation Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 17
17
18
18
package org .apache .kyuubi .operation
19
19
20
+ import java .io .IOException
20
21
import java .util .concurrent .{Future , ScheduledExecutorService , TimeUnit }
21
22
import java .util .concurrent .locks .ReentrantLock
22
23
@@ -247,4 +248,19 @@ abstract class AbstractOperation(session: Session) extends Operation with Loggin
247
248
ok.setInfoMessages(hints.asJava)
248
249
ok
249
250
}
251
+
252
+ /**
253
+ * Close the OperationLog, after running the block
254
+ */
255
+ def withClosingOperationLog [T ](f : => T ): T = {
256
+ try {
257
+ f
258
+ } finally {
259
+ try {
260
+ getOperationLog.foreach(_.close())
261
+ } catch {
262
+ case e : IOException => error(e.getMessage, e)
263
+ }
264
+ }
265
+ }
250
266
}
Original file line number Diff line number Diff line change @@ -336,7 +336,7 @@ class BatchJobSubmission(
336
336
}
337
337
}
338
338
339
- override def close (): Unit = withLockRequired {
339
+ override def close (): Unit = withLockRequired(withClosingOperationLog {
340
340
if (! isClosedOrCanceled) {
341
341
MetricsSystem .tracing(_.decCount(MetricRegistry .name(OPERATION_OPEN , opType)))
342
342
@@ -373,13 +373,7 @@ class BatchJobSubmission(
373
373
}
374
374
}
375
375
}
376
-
377
- try {
378
- getOperationLog.foreach(_.close())
379
- } catch {
380
- case e : IOException => error(e.getMessage, e)
381
- }
382
- }
376
+ })
383
377
384
378
override def cancel (): Unit = {
385
379
throw new IllegalStateException (" Use close instead." )
You can’t perform that action at this time.
0 commit comments