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. Protected

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

Inherited from PartialFunction[Throwable, Unit]

Inherited from (Throwable) => Unit

Inherited from AnyRef

Inherited from Any

Ungrouped