Packages

t

com.twitter.util.Promise

InterruptHandler

trait InterruptHandler extends PartialFunction[Throwable, Unit]

Embeds an "interrupt handler" into a Promise.

This is a total handler such that it's defined on any Throwable. Use Promise.setInterruptHandler() if you need to leave an interrupt handler undefined for certain types of exceptions.

Example: (p and q are equivalent, but p allocates less):

import com.twitter.util.Promise

val p = new Promise[A] with Promise.InterruptHandler {
  def onInterrupt(t: Throwable): Unit = setException(t)
}

val q = new Promise[A]
q.setInterruptHandler { case t: Throwable => q.setException(t) }
Self Type
InterruptHandler with Promise[_]
Note

Later calls to setInterruptHandler on a promise mixing in this trait will replace the embedded handler.

Linear Supertypes
PartialFunction[Throwable, Unit], (Throwable) ⇒ Unit, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. InterruptHandler
  2. PartialFunction
  3. Function1
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def onInterrupt(t: Throwable): Unit

    Triggered on any interrupt (even a fatal one).

    Triggered on any interrupt (even a fatal one).

    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def andThen[C](k: (Unit) ⇒ C): PartialFunction[Throwable, C]
    Definition Classes
    PartialFunction → Function1
  5. final def apply(t: Throwable): Unit
    Definition Classes
    InterruptHandler → Function1
  6. def applyOrElse[A1 <: Throwable, B1 >: Unit](x: A1, default: (A1) ⇒ B1): B1
    Definition Classes
    PartialFunction
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  9. def compose[A](g: (A) ⇒ Throwable): (A) ⇒ Unit
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isDefinedAt(x: Throwable): Boolean
    Definition Classes
    InterruptHandler → PartialFunction
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. def lift: (Throwable) ⇒ Option[Unit]
    Definition Classes
    PartialFunction
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. def orElse[A1 <: Throwable, B1 >: Unit](that: PartialFunction[A1, B1]): PartialFunction[A1, B1]
    Definition Classes
    PartialFunction
  22. def runWith[U](action: (Unit) ⇒ U): (Throwable) ⇒ Boolean
    Definition Classes
    PartialFunction
  23. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  24. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any
  25. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from PartialFunction[Throwable, Unit]

Inherited from (Throwable) ⇒ Unit

Inherited from AnyRef

Inherited from Any

Ungrouped