Trait

com.twitter.util.Promise

InterruptHandler

Related Doc: package Promise

Permalink

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

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def andThen[C](k: (Unit) ⇒ C): PartialFunction[Throwable, C]

    Permalink
    Definition Classes
    PartialFunction → Function1
  5. final def apply(t: Throwable): Unit

    Permalink
    Definition Classes
    InterruptHandler → Function1
  6. def applyOrElse[A1 <: Throwable, B1 >: Unit](x: A1, default: (A1) ⇒ B1): B1

    Permalink
    Definition Classes
    PartialFunction
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def compose[A](g: (A) ⇒ Throwable): (A) ⇒ Unit

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isDefinedAt(x: Throwable): Boolean

    Permalink
    Definition Classes
    InterruptHandler → PartialFunction
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. def lift: (Throwable) ⇒ Option[Unit]

    Permalink
    Definition Classes
    PartialFunction
  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. def orElse[A1 <: Throwable, B1 >: Unit](that: PartialFunction[A1, B1]): PartialFunction[A1, B1]

    Permalink
    Definition Classes
    PartialFunction
  22. def runWith[U](action: (Unit) ⇒ U): (Throwable) ⇒ Boolean

    Permalink
    Definition Classes
    PartialFunction
  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  24. def toString(): String

    Permalink
    Definition Classes
    Function1 → AnyRef → Any
  25. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from PartialFunction[Throwable, Unit]

Inherited from (Throwable) ⇒ Unit

Inherited from AnyRef

Inherited from Any

Ungrouped