wip
This commit is contained in:
parent
f00c4f61be
commit
87cb83f0d7
1 changed files with 13 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ package akka.dispatch.japi
|
|||
import akka.util.Timeout
|
||||
import akka.japi.{ Procedure2, Procedure, Function ⇒ JFunc, Option ⇒ JOption }
|
||||
|
||||
@deprecated("Do not use this directly, use subclasses of this", "2.0")
|
||||
class Callback[-T] extends PartialFunction[T, Unit] {
|
||||
override final def isDefinedAt(t: T): Boolean = true
|
||||
override final def apply(t: T): Unit = on(t)
|
||||
|
|
@ -30,6 +31,18 @@ abstract class OnComplete[-T] extends Callback[Either[Throwable, T]] {
|
|||
def onComplete(failure: Throwable, success: T): Unit
|
||||
}
|
||||
|
||||
@deprecated("Do not use this directly, use 'Recover'", "2.0")
|
||||
class RecoverBridge[+T] extends PartialFunction[Throwable, T] {
|
||||
override final def isDefinedAt(t: Throwable): Boolean = true
|
||||
override final def apply(t: Throwable): T = on(t)
|
||||
protected def on(result: Throwable): T = null.asInstanceOf[T]
|
||||
}
|
||||
|
||||
abstract class Recover[+T] extends RecoverBridge[T] {
|
||||
protected final override def on(result: Throwable): T = recover(result)
|
||||
def recover(failure: Throwable): T
|
||||
}
|
||||
|
||||
abstract class Filter[-T] extends (T ⇒ Boolean) {
|
||||
override final def apply(t: T): Boolean = filter(t)
|
||||
def filter(result: T): Boolean
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue