Permalink
Browse files

use map to set idleTimeTask and lifeTimeTask

  • Loading branch information...
1 parent a2d0b26 commit 0ca06025ff1123524e299c486fd2eaf7b3f891de Wanli Yang committed Mar 21, 2011
Showing with 2 additions and 15 deletions.
  1. +2 −15 finagle-core/src/main/scala/com/twitter/finagle/service/ExpiringService.scala
@@ -22,21 +22,8 @@ class ExpiringService[Req, Rep](
{
private[this] var requestCount = 0
private[this] var expired = false
- private[this] var idleTimeTask: Option[com.twitter.util.TimerTask] =
- maxIdleTime match {
- case Some(idleTime: Duration) =>
- Some(timer.schedule(idleTime.fromNow) { maybeIdleExpire() })
- case _ =>
- None
- }
-
- private[this] var lifeTimeTask: Option[com.twitter.util.TimerTask] =
- maxLifeTime match {
- case Some(lifeTime: Duration) =>
- Some(timer.schedule(lifeTime.fromNow) { maybeLifeTimeExpire() })
- case _ =>
- None
- }
+ private[this] var idleTimeTask = maxIdleTime map { idleTime => timer.schedule(idleTime.fromNow) { maybeIdleExpire() } }
+ private[this] var lifeTimeTask = maxLifeTime map { lifeTime => timer.schedule(lifeTime.fromNow) { maybeLifeTimeExpire() } }
private[this] def maybeExpire() = {
val justExpired = synchronized {

0 comments on commit 0ca0602

Please sign in to comment.