Trait/Object

com.fulcrumgenomics.commons.async

AsyncRunnable

Related Docs: object AsyncRunnable | package async

Permalink

trait AsyncRunnable extends Runnable

A trait that can be mixed in to help manage asynchronous execution while being Runnable.

The execute() method should contain the work to be performed asynchronously.

The thread() method can be used to return a Thread that wraps this Runnable.

The start() method can be used to create and start daemon Thread that wraps this Runnable.

The checkAndRaise() method should be used by implementing classes to check if the execute() method has encountered an exception, and if so, it will rethrow the exception as an Error or RuntimeException.

The tryAndModifyInterruptedException() method should wrap blocking code in implementing classes that are not part of the execute() method. This method will throw a RuntimeException if interrupted while waiting.

Linear Supertypes
Runnable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AsyncRunnable
  2. Runnable
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def execute(): Unit

    Permalink

    The method that does the asynchronous work.

    The method that does the asynchronous work.

    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. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from AsyncRunnable to any2stringadd[AsyncRunnable] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (AsyncRunnable, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from AsyncRunnable to ArrowAssoc[AsyncRunnable] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def awaitDone(): Unit

    Permalink

    Waits for the run() method to complete.

  8. def awaitStart(): Unit

    Permalink

    Waits for the run() method to start.

  9. final def checkAndRaise(): Unit

    Permalink

    Checks to see if an exception has been raised by an asynchronous thread and if so rethrows it.

    Checks to see if an exception has been raised by an asynchronous thread and if so rethrows it. Use this method before code that assumes the threads have not encountered an exception.

    Attributes
    protected
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def done: Boolean

    Permalink

    Returns true if the run() method has completed, false otherwise.

  12. def ensuring(cond: (AsyncRunnable) ⇒ Boolean, msg: ⇒ Any): AsyncRunnable

    Permalink
    Implicit information
    This member is added by an implicit conversion from AsyncRunnable to Ensuring[AsyncRunnable] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: (AsyncRunnable) ⇒ Boolean): AsyncRunnable

    Permalink
    Implicit information
    This member is added by an implicit conversion from AsyncRunnable to Ensuring[AsyncRunnable] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean, msg: ⇒ Any): AsyncRunnable

    Permalink
    Implicit information
    This member is added by an implicit conversion from AsyncRunnable to Ensuring[AsyncRunnable] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean): AsyncRunnable

    Permalink
    Implicit information
    This member is added by an implicit conversion from AsyncRunnable to Ensuring[AsyncRunnable] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from AsyncRunnable to StringFormat[AsyncRunnable] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  20. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  23. val name: String

    Permalink

    The name of this runnable.

    The name of this runnable. This is used as the name of the thread in thread() as well. The name is created based on the class name and the number of AsyncRunnables already created.

  24. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  27. final def run(): Unit

    Permalink
    Definition Classes
    AsyncRunnable → Runnable
  28. final def start(name: Option[String] = None, daemon: Boolean = true): AsyncRunnable.this.type

    Permalink

    Starts this Runnable in a daemon thread.

    Starts this Runnable in a daemon thread.

    name

    optionally the name of the thread, otherwise a name is created based on the class name and the number of threads already created.

  29. def started: Boolean

    Permalink

    Returns true if the run() method has started, false otherwise.

  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. final def thread(): Thread

    Permalink

    Creates a new thread wrapping this runnable; the thread is not started.

  32. def throwable: Option[Throwable]

    Permalink

    Returns a throwable if an exception occurred in the run() method, None otherwise.

  33. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  34. def tryAndModifyInterruptedException[T](message: String)(f: ⇒ T): T

    Permalink

    Executes the given block of code.

    Executes the given block of code. If an InterruptedException is thrown, throws a RuntimeException with the given message. Use this method for blocking code that when interrupted should not be recoverable.

    message

    the message to use if an InterruptedException is thrown by the block of code

    f

    the block of code to execute

    Attributes
    protected
  35. def uponDone()(implicit ec: ExecutionContext): Awaitable[Option[Throwable]]

    Permalink

    Returns an Awaitable that completes when the run() method has completed.

    Returns an Awaitable that completes when the run() method has completed. Returns the throwable if an exception was encountered, None otherwise.

  36. def uponException(): Unit

    Permalink

    The method to execute if an exception occurs in the asynchronous thread.

    The method to execute if an exception occurs in the asynchronous thread. This should not block.

    Attributes
    protected
  37. def uponFinally(): Unit

    Permalink

    The method to execute upon successfully execution of the run method or an exception occurs.

    The method to execute upon successfully execution of the run method or an exception occurs. This should not block.

    Attributes
    protected
  38. def uponStart()(implicit ec: ExecutionContext): Awaitable[Unit]

    Permalink

    Returns an Awaitable that completes when the run() method has started.

    Returns an Awaitable that completes when the run() method has started. Returns the throwable if an exception was encountered, None otherwise.

  39. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. def [B](y: B): (AsyncRunnable, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from AsyncRunnable to ArrowAssoc[AsyncRunnable] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Runnable

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from AsyncRunnable to any2stringadd[AsyncRunnable]

Inherited by implicit conversion StringFormat from AsyncRunnable to StringFormat[AsyncRunnable]

Inherited by implicit conversion Ensuring from AsyncRunnable to Ensuring[AsyncRunnable]

Inherited by implicit conversion ArrowAssoc from AsyncRunnable to ArrowAssoc[AsyncRunnable]

Ungrouped