[KYUUBI #4861] Support Flink session idleness

### _Why are the changes needed?_

Support Flink session idleness.

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #4862 from link3280/KYUUBI-4861.

Closes #4861

463d1bf9f [Paul Lin] [KYUUBI #4861] Fix class cast exception
882203157 [Paul Lin] [KYUUBI #4861] Improve code style
451403882 [Paul Lin] [KYUUBI #4861] Support Flink session idleness

Authored-by: Paul Lin <paullin3280@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
Paul Lin 2023-05-20 10:38:13 +08:00 committed by Cheng Pan
parent cd47b13127
commit 52464c25da
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D

View File

@ -70,6 +70,12 @@ class FlinkSQLSessionManager(engineContext: DefaultContext)
}
}
override def getSessionOption(sessionHandle: SessionHandle): Option[Session] = {
val session = super.getSessionOption(sessionHandle)
session.foreach(s => s.asInstanceOf[FlinkSessionImpl].fSession.touch())
session
}
override def closeSession(sessionHandle: SessionHandle): Unit = {
super.closeSession(sessionHandle)
sessionManager.closeSession(