Skip to content

Commit

Permalink
Merge pull request #1300 from vmarquez/series7_removeDeprecation
Browse files Browse the repository at this point in the history
removing the methods in Future/Task that were deprecated in 7.2
  • Loading branch information
vmarquez committed Nov 30, 2016
2 parents f289d49 + b359f35 commit 47dd141
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 105 deletions.
55 changes: 2 additions & 53 deletions concurrent/src/main/scala/scalaz/concurrent/Future.scala
Expand Up @@ -79,11 +79,6 @@ sealed abstract class Future[+A] {
onFinish(x => Trampoline.delay(g(x)) map (_ unsafePerformListen cb))
}


@deprecated("use unsafePerformListen", "7.2")
def listen(cb: A => Trampoline[Unit]): Unit =
unsafePerformListen(cb)

/**
* Run this computation to obtain an `A`, so long as `cancel` remains false.
* Because of trampolining, we get frequent opportunities to cancel
Expand All @@ -104,10 +99,6 @@ sealed abstract class Future[+A] {
case _ if cancel.get => ()
}

@deprecated("use unsafePerformListenInterruptibly", "7.2")
def listenInterruptibly(cb: A => Trampoline[Unit], cancel: AtomicBoolean): Unit =
unsafePerformListenInterruptibly(cb, cancel)

/**
* Evaluate this `Future` to a result, or another asynchronous computation.
* This has the effect of stripping off any 'pure' trampolined computation at
Expand Down Expand Up @@ -145,11 +136,7 @@ sealed abstract class Future[+A] {
delay { latch.await; result.get }
}

@deprecated("use unsafeStart", "7.2")
def start: Future[A] =
unsafeStart

/**
/**
* Run this `Future`, passing the result to the given callback once available.
* Any pure, non-asynchronous computation at the head of this `Future` will
* be forced in the calling thread. At the first `Async` encountered, control
Expand All @@ -158,10 +145,6 @@ sealed abstract class Future[+A] {
def unsafePerformAsync(cb: A => Unit): Unit =
unsafePerformListen(a => Trampoline.done(cb(a)))

@deprecated("use unsafePerformAsync", "7.2")
def runAsync(cb: A => Unit): Unit =
unsafePerformAsync(cb)

/**
* Run this computation to obtain an `A`, so long as `cancel` remains false.
* Because of trampolining, we get frequent opportunities to cancel
Expand All @@ -171,10 +154,6 @@ sealed abstract class Future[+A] {
def unsafePerformAsyncInterruptibly(cb: A => Unit, cancel: AtomicBoolean): Unit =
unsafePerformListenInterruptibly(a => Trampoline.done(cb(a)), cancel)

@deprecated("use unsafePerformAsyncInterruptibly", "7.2")
def runAsyncInterruptibly(cb: A => Unit, cancel: AtomicBoolean): Unit =
unsafePerformAsyncInterruptibly(cb, cancel)

/** Run this `Future` and block awaiting its result. */
def unsafePerformSync: A = this match {
case Now(a) => a
Expand All @@ -187,10 +166,6 @@ sealed abstract class Future[+A] {
}
}

@deprecated("use unsafePerformSync", "7.2")
def run: A =
unsafePerformSync

/**
* Run this `Future` and block until its result is available, or until
* `timeoutInMillis` milliseconds have elapsed, at which point a `TimeoutException`
Expand All @@ -205,15 +180,6 @@ sealed abstract class Future[+A] {
def unsafePerformSyncFor(timeout: Duration): A =
unsafePerformSyncFor(timeout.toMillis)

@deprecated("use unsafePerformSyncFor", "7.2")
def runFor(timeoutInMillis: Long): A =
unsafePerformSyncFor(timeoutInMillis)

@deprecated("use unsafePerformSyncFor", "7.2")
def runFor(timeout: Duration): A =
unsafePerformSyncFor(timeout)


/** Like `unsafePerformSyncFor`, but returns `TimeoutException` as left value.
* Will not report any other exceptions that may be raised during computation of `A`*/
def unsafePerformSyncAttemptFor(timeoutInMillis: Long): Throwable \/ A = {
Expand All @@ -229,16 +195,7 @@ sealed abstract class Future[+A] {
def unsafePerformSyncAttemptFor(timeout: Duration): Throwable \/ A =
unsafePerformSyncAttemptFor(timeout.toMillis)

@deprecated("use unsafePerformSyncAttemptFor", "7.2")
def attemptRunFor(timeoutInMillis: Long): Throwable \/ A =
unsafePerformSyncAttemptFor(timeoutInMillis)

@deprecated("use unsafePerformSyncAttemptFor", "7.2")
def attemptRunFor(timeout: Duration): Throwable \/ A =
unsafePerformSyncAttemptFor(timeout)


/**
/**
* Returns a `Future` which returns a `TimeoutException` after `timeoutInMillis`,
* and attempts to cancel the running computation.
* This implementation will not block the future's execution thread
Expand All @@ -265,14 +222,6 @@ sealed abstract class Future[+A] {
def timed(timeout: Duration)(implicit scheduler:ScheduledExecutorService = Strategy.DefaultTimeoutScheduler): Future[Throwable \/ A] =
timed(timeout.toMillis)

@deprecated("use timed", "7.2")
def unsafePerformTimed(timeout: Duration)(implicit scheduler:ScheduledExecutorService = Strategy.DefaultTimeoutScheduler): Future[Throwable \/ A] =
timed(timeout.toMillis)

@deprecated("use timed", "7.2")
def unsafePerformTimed(timeoutInMillis: Long)(implicit scheduler:ScheduledExecutorService): Future[Throwable \/ A] =
timed(timeoutInMillis)

/**
* Returns a `Future` that delays the execution of this `Future` by the duration `t`.
*/
Expand Down
52 changes: 0 additions & 52 deletions concurrent/src/main/scala/scalaz/concurrent/Task.scala
Expand Up @@ -100,18 +100,10 @@ class Task[+A](val get: Future[Throwable \/ A]) {
case \/-(a) => a
}

@deprecated("use unsafePerformSync", "7.2")
def run: A =
unsafePerformSync

/** Like `unsafePerformSync`, but returns exceptions as values. */
def unsafePerformSyncAttempt: Throwable \/ A =
try get.unsafePerformSync catch { case t: Throwable => -\/(t) }

@deprecated("use unsafePerformSyncAttempt", "7.2")
def attemptRun: Throwable \/ A =
unsafePerformSyncAttempt

/**
* Run this computation to obtain an `A`, so long as `cancel` remains false.
* Because of trampolining, we get frequent opportunities to cancel
Expand All @@ -121,10 +113,6 @@ class Task[+A](val get: Future[Throwable \/ A]) {
def unsafePerformAsyncInterruptibly(f: (Throwable \/ A) => Unit, cancel: AtomicBoolean): Unit =
get.unsafePerformAsyncInterruptibly(f, cancel)

@deprecated("use unsafePerformAsyncInterruptibly", "7.2")
def runAsyncInterruptibly(f: (Throwable \/ A) => Unit, cancel: AtomicBoolean): Unit =
unsafePerformAsyncInterruptibly(f, cancel)

/**
* Similar to `unsafePerformAsyncInterruptibly(f,cancel)` except instead of interrupting by setting cancel to true,
* It returns the function, that, when applied will interrupt the task.
Expand Down Expand Up @@ -155,10 +143,6 @@ class Task[+A](val get: Future[Throwable \/ A]) {
() => { a ! None }
}

@deprecated("use unsafePerformAsyncInterruptibly", "7.2")
def runAsyncInterruptibly(f: (Throwable \/ A) => Unit) : () => Unit =
unsafePerformAsyncInterruptibly(f)

/**
* Run this computation to obtain either a result or an exception, then
* invoke the given callback. Any pure, non-asynchronous computation at the
Expand All @@ -169,10 +153,6 @@ class Task[+A](val get: Future[Throwable \/ A]) {
def unsafePerformAsync(f: (Throwable \/ A) => Unit): Unit =
get.unsafePerformAsync(f)

@deprecated("use unsafePerformAsync", "7.2")
def runAsync(f: (Throwable \/ A) => Unit): Unit =
unsafePerformAsync(f)

/**
* Run this `Task` and block until its result is available, or until
* `timeoutInMillis` milliseconds have elapsed, at which point a `TimeoutException`
Expand All @@ -187,32 +167,16 @@ class Task[+A](val get: Future[Throwable \/ A]) {
def unsafePerformSyncFor(timeout: Duration): A =
unsafePerformSyncFor(timeout.toMillis)

@deprecated("use unsafePerformSyncFor", "7.2")
def runFor(timeoutInMillis: Long): A =
unsafePerformSyncFor(timeoutInMillis)

@deprecated("use unsafePerformSyncFor", "7.2")
def runFor(timeout: Duration): A =
unsafePerformSyncFor(timeout)

/**
* Like `unsafePerformSyncFor`, but returns exceptions as values. Both `TimeoutException`
* and other exceptions will be folded into the same `Throwable`.
*/
def unsafePerformSyncAttemptFor(timeoutInMillis: Long): Throwable \/ A =
get.unsafePerformSyncAttemptFor(timeoutInMillis).join

@deprecated("use unsafePerformSyncAttemptFor", "7.2")
def attemptRunFor(timeoutInMillis: Long): Throwable \/ A =
unsafePerformSyncAttemptFor(timeoutInMillis)

def unsafePerformSyncAttemptFor(timeout: Duration): Throwable \/ A =
unsafePerformSyncAttemptFor(timeout.toMillis)

@deprecated("use unsafePerformSyncAttemptFor", "7.2")
def attemptRunFor(timeout: Duration): Throwable \/ A =
unsafePerformSyncAttemptFor(timeout)

/**
* A `Task` which returns a `TimeoutException` after `timeoutInMillis`,
* and attempts to cancel the running computation.
Expand All @@ -223,14 +187,6 @@ class Task[+A](val get: Future[Throwable \/ A]) {
def timed(timeout: Duration)(implicit scheduler:ScheduledExecutorService = Strategy.DefaultTimeoutScheduler): Task[A] =
timed(timeout.toMillis)

@deprecated("use timed", "7.2")
def unsafePerformTimed(timeout: Duration)(implicit scheduler:ScheduledExecutorService = Strategy.DefaultTimeoutScheduler): Task[A] =
timed(timeout)

@deprecated("use timed", "7.2")
def unsafePerformTimed(timeoutInMillis: Long)(implicit scheduler:ScheduledExecutorService): Task[A] =
timed(timeoutInMillis)

/**
* Retries this task if it fails, once for each element in `delays`,
* each retry delayed by the corresponding duration, accumulating
Expand All @@ -240,10 +196,6 @@ class Task[+A](val get: Future[Throwable \/ A]) {
def retryAccumulating(delays: Seq[Duration], p: (Throwable => Boolean) = _.isInstanceOf[Exception]): Task[(A, List[Throwable])] =
retryInternal(delays, p, true)

@deprecated("use retryAccumulating", "7.2")
def unsafePerformRetryAccumulating(delays: Seq[Duration], p: (Throwable => Boolean) = _.isInstanceOf[Exception]): Task[(A, List[Throwable])] =
retryAccumulating(delays, p)

/**
* Retries this task if it fails, once for each element in `delays`,
* each retry delayed by the corresponding duration.
Expand All @@ -252,10 +204,6 @@ class Task[+A](val get: Future[Throwable \/ A]) {
def retry(delays: Seq[Duration], p: (Throwable => Boolean) = _.isInstanceOf[Exception]): Task[A] =
retryInternal(delays, p, false).map(_._1)

@deprecated("use retry", "7.2")
def unsafePerformRetry(delays: Seq[Duration], p: (Throwable => Boolean) = _.isInstanceOf[Exception]): Task[A] =
retry(delays, p)

private def retryInternal(delays: Seq[Duration],
p: (Throwable => Boolean),
accumulateErrors: Boolean): Task[(A, List[Throwable])] = {
Expand Down

0 comments on commit 47dd141

Please sign in to comment.