Skip to content

Commit

Permalink
catch all
Browse files Browse the repository at this point in the history
log session type
  • Loading branch information
turboFei committed Nov 19, 2023
1 parent 3478fc9 commit d726a84
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ abstract class SessionManager(name: String) extends CompositeService(name) {
conf: Map[String, String]): Session

protected def logSessionCountInfo(session: Session, action: String): Unit = {
info(s"${session.user}'s session with" +
info(s"${session.user}'s ${session.getClass.getSimpleName} with" +
s" ${session.handle}${session.name.map("/" + _).getOrElse("")} is $action," +
s" current opening sessions $getOpenSessionCount")
}
Expand Down Expand Up @@ -303,20 +303,21 @@ abstract class SessionManager(name: String) extends CompositeService(name) {

val checkTask = new Runnable {
override def run(): Unit = {
info(s"Checking sessions timeout, current count: $getOpenSessionCount")
val current = System.currentTimeMillis
if (!shutdown) {
for (session <- handleToSession.values().asScala) {
if (session.lastAccessTime + session.sessionIdleTimeoutThreshold <= current &&
session.getNoOperationTime > session.sessionIdleTimeoutThreshold) {
info(s"Closing session ${session.handle.identifier} that has been idle for more" +
s" than ${session.sessionIdleTimeoutThreshold} ms")
try {
try {
if (session.lastAccessTime + session.sessionIdleTimeoutThreshold <= current &&
session.getNoOperationTime > session.sessionIdleTimeoutThreshold) {
info(s"Closing session ${session.handle.identifier} that has been idle for more" +
s" than ${session.sessionIdleTimeoutThreshold} ms")
closeSession(session.handle)
} catch {
case NonFatal(e) => warn(s"Error closing idle session ${session.handle}", e)
} else {
session.closeExpiredOperations()
}
} else {
session.closeExpiredOperations()
} catch {
case NonFatal(e) => warn(s"Error checking session ${session.handle} timeout", e)
}
}
}
Expand Down

0 comments on commit d726a84

Please sign in to comment.