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
Ordering
- Alphabetic
- By Inheritance
Inherited
- InterruptHandler
- PartialFunction
- Function1
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Abstract Value Members
- 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
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def andThen[C](k: PartialFunction[Unit, C]): PartialFunction[Throwable, C]
- Definition Classes
- PartialFunction
- def andThen[C](k: (Unit) => C): PartialFunction[Throwable, C]
- Definition Classes
- PartialFunction → Function1
- final def apply(t: Throwable): Unit
- Definition Classes
- InterruptHandler → Function1
- def applyOrElse[A1 <: Throwable, B1 >: Unit](x: A1, default: (A1) => B1): B1
- Definition Classes
- PartialFunction
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def compose[R](k: PartialFunction[R, Throwable]): PartialFunction[R, Unit]
- Definition Classes
- PartialFunction
- def compose[A](g: (A) => Throwable): (A) => Unit
- Definition Classes
- Function1
- Annotations
- @unspecialized()
- def elementWise: ElementWiseExtractor[Throwable, Unit]
- Definition Classes
- PartialFunction
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isDefinedAt(x: Throwable): Boolean
- Definition Classes
- InterruptHandler → PartialFunction
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lift: (Throwable) => Option[Unit]
- Definition Classes
- PartialFunction
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def orElse[A1 <: Throwable, B1 >: Unit](that: PartialFunction[A1, B1]): PartialFunction[A1, B1]
- Definition Classes
- PartialFunction
- def runWith[U](action: (Unit) => U): (Throwable) => Boolean
- Definition Classes
- PartialFunction
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- Function1 → AnyRef → Any
- def unapply(a: Throwable): Option[Unit]
- Definition Classes
- PartialFunction
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()