Skip to content

Commit

Permalink
Change after function to use scheduler instead of Timer
Browse files Browse the repository at this point in the history
  • Loading branch information
nlim committed Dec 14, 2015
1 parent cb6dd99 commit 1d05cd5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions concurrent/src/main/scala/scalaz/concurrent/Future.scala
Expand Up @@ -276,11 +276,11 @@ sealed abstract class Future[+A] {
/**
* Returns a `Future` that delays the execution of this `Future` by the duration `t`.
*/
def after(t: Duration): Future[A] =
after(t.toMillis)
def after(t: Duration)(implicit scheduler:ScheduledExecutorService = Strategy.DefaultTimeoutScheduler): Future[A] =
schedule((), t)(scheduler).flatMap(_ => this)

def after(t: Long): Future[A] =
Timer.default.valueWait((), t).flatMap(_ => this)
def afterMillis(delay: Long)(implicit scheduler:ScheduledExecutorService = Strategy.DefaultTimeoutScheduler): Future[A] =
after(FiniteDuration(delay, TimeUnit.MILLISECONDS))(scheduler)
}

object Future {
Expand Down

0 comments on commit 1d05cd5

Please sign in to comment.