Repository: incubator-livy Updated Branches: refs/heads/master 56c76bc2d -> df25e6f08
[LIVY-520] Add log when session is GC-ed ## What changes were proposed in this pull request? When a session is inactive for a long time, it is GC-ed, ie. it is closed. Currently this operation is not logged, so it is not easy to understand why a session was closed. The PR proposes to add a log in order to explain what happened. ## How was this patch tested? manual tests Author: Marco Gaido <mga...@hortonworks.com> Closes #116 from mgaido91/LIVY-520. Project: http://git-wip-us.apache.org/repos/asf/incubator-livy/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-livy/commit/df25e6f0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-livy/tree/df25e6f0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-livy/diff/df25e6f0 Branch: refs/heads/master Commit: df25e6f0858ac7eec145e47acc54124c2205b0a2 Parents: 56c76bc Author: Marco Gaido <mga...@hortonworks.com> Authored: Mon Oct 1 13:38:29 2018 -0700 Committer: Marcelo Vanzin <van...@cloudera.com> Committed: Mon Oct 1 13:38:29 2018 -0700 ---------------------------------------------------------------------- .../main/scala/org/apache/livy/sessions/SessionManager.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-livy/blob/df25e6f0/server/src/main/scala/org/apache/livy/sessions/SessionManager.scala ---------------------------------------------------------------------- diff --git a/server/src/main/scala/org/apache/livy/sessions/SessionManager.scala b/server/src/main/scala/org/apache/livy/sessions/SessionManager.scala index d482c33..5926071 100644 --- a/server/src/main/scala/org/apache/livy/sessions/SessionManager.scala +++ b/server/src/main/scala/org/apache/livy/sessions/SessionManager.scala @@ -149,7 +149,10 @@ class SessionManager[S <: Session, R <: RecoveryMetadata : ClassTag]( } } - Future.sequence(all().filter(expired).map(delete)) + Future.sequence(all().filter(expired).map { s => + info(s"Deleting $s because it was inactive for more than ${sessionTimeout / 1e6} ms.") + delete(s) + }) } private def recover(): Seq[S] = {