Object

com.thoughtworks.raii.asynchronous

Do

Related Doc: package asynchronous

Permalink

object Do

The companion object of Do

Source
asynchronous.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Do
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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 apply[Value](future: UnitContinuation[Releasable[UnitContinuation, Try[Value]]]): Do[Value]

    Permalink

  5. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def delay[Value](value: ⇒ Value): Do[Value]

    Permalink

    Returns a non-strict Do whose release operation is no-op.

    Returns a non-strict Do whose release operation is no-op.

    Since the Do is non-strict, Value will be recreated each time it is sequenced into a larger Do.

    See also

    scoped for auto-closeable Do

    now for strict garbage collected Do

  8. def delay[Value](continuation: ContT[Trampoline, Unit, Value]): Do[Value]

    Permalink

    Returns a non-strict Do whose release operation is no-op.

    Returns a non-strict Do whose release operation is no-op.

    Since the Do is non-strict, Value will be recreated each time it is sequenced into a larger Do.

    See also

    scoped for auto-closeable Do

    now for strict garbage collected Do

  9. implicit def doMonadErrorInstances: MonadError[Do, Throwable]

    Permalink

  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. def fromContinuation[Value](future: UnitContinuation[Value]): Do[Value]

    Permalink

    Returns a non-strict Do whose release operation is no-op.

    Returns a non-strict Do whose release operation is no-op.

    Since the Do is non-strict, Value will be recreated each time it is sequenced into a larger Do.

    See also

    scoped for auto-closeable Do

    now for strict garbage collected Do

  14. def fromFuture[Value](future: Future[Value]): Do[Value]

    Permalink

    Returns a non-strict Do whose release operation is no-op.

    Returns a non-strict Do whose release operation is no-op.

    Since the Do is non-strict, Value will be recreated each time it is sequenced into a larger Do.

    See also

    scoped for auto-closeable Do

    now for strict garbage collected Do

  15. final def getClass(): Class[_]

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

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

    Permalink
    Definition Classes
    Any
  18. def jump()(implicit executorContext: ExecutionContext): Do[Unit]

    Permalink

    Returns a Do that runs in executorContext

    Returns a Do that runs in executorContext

    Note

    This method is usually been used for changing the current thread.

    import java.util.concurrent._
    import scala.concurrent._
    import scalaz.syntax.all._
    import com.thoughtworks.raii.asynchronous.Do, Do._
    implicit def executorContext = ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor())
    val mainThread = Thread.currentThread
    Do.run {
      for {
        _ <- Do.delay(())
        threadBeforeJump = Thread.currentThread
        _ = threadBeforeJump should be(mainThread)
        _ <- Do.jump()
        threadAfterJump = Thread.currentThread
      } yield {
        threadAfterJump shouldNot be(mainThread)
      }
    }
  19. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  22. def now[Value](value: Value): Do[Value]

    Permalink

    Converts a strict value to a Do whose release operation is no-op.

    Converts a strict value to a Do whose release operation is no-op.

    See also

    scoped for auto-closeable Do

    delay for non-strict garbage collected Do

  23. def releaseFlatMap[Value, B](doValue: Do[Value])(f: (Value) ⇒ Do[B]): Do[B]

    Permalink

    Returns a Do of B based on a Do of Value and a function that creates a Do of B.

    Returns a Do of B based on a Do of Value and a function that creates a Do of B.

    Note

    releaseFlatMap is similar to flatMap in doMonadErrorInstances, except releaseFlatMap will release Value right after B is created.

  24. def releaseMap[Value, B](doValue: Do[Value])(f: (Value) ⇒ B): Do[B]

    Permalink

    Returns a Do of B based on a Do of Value and a function that creates B.

    Returns a Do of B based on a Do of Value and a function that creates B.

    Note

    releaseMap is similar to map in doMonadErrorInstances, except releaseMap will release Value right after B is created.

  25. def run[Value](doValue: Do[Value]): Future[Value]

    Permalink

    Returns a Future of Value, which will open Value and release all resources during opening Value.

    Returns a Future of Value, which will open Value and release all resources during opening Value.

    Note

    Value itself must not be a scoped resources, though Value may depends on some scoped resources during opening Value.

  26. def scoped[Value <: AutoCloseable](value: ⇒ Value): Do[Value]

    Permalink

    Returns a non-strict Do whose release operation is java.lang.AutoCloseable.close.

    Returns a non-strict Do whose release operation is java.lang.AutoCloseable.close.

    Since the Do is non-strict, Value will be recreated each time it is sequenced into a larger Do.

    See also

    delay for non-strict garbage collected Do

    now for strict garbage collected Do

  27. def scoped[Value <: AutoCloseable](continuation: ContT[Trampoline, Unit, Value]): Do[Value]

    Permalink

    Returns a non-strict Do whose release operation is java.lang.AutoCloseable.close.

    Returns a non-strict Do whose release operation is java.lang.AutoCloseable.close.

    Since the Do is non-strict, Value will be recreated each time it is sequenced into a larger Do.

    See also

    delay for non-strict garbage collected Do

    now for strict garbage collected Do

  28. def scoped[Value <: AutoCloseable](future: UnitContinuation[Value], dummyImplicit: DummyImplicit = DummyImplicit.dummyImplicit): Do[Value]

    Permalink

    Returns a non-strict Do whose release operation is java.lang.AutoCloseable.close.

    Returns a non-strict Do whose release operation is java.lang.AutoCloseable.close.

    Since the Do is non-strict, Value will be recreated each time it is sequenced into a larger Do.

    See also

    delay for non-strict garbage collected Do

    now for strict garbage collected Do

  29. def scoped[Value <: AutoCloseable](future: Future[Value]): Do[Value]

    Permalink

    Returns a non-strict Do whose release operation is java.lang.AutoCloseable.close.

    Returns a non-strict Do whose release operation is java.lang.AutoCloseable.close.

    Since the Do is non-strict, Value will be recreated each time it is sequenced into a larger Do.

    See also

    delay for non-strict garbage collected Do

    now for strict garbage collected Do

  30. def shared[Value](doValue: Do[Value]): Do[Value]

    Permalink

    Converts doValue to a reference counted wrapper Do.

    Converts doValue to a reference counted wrapper Do.

    When the wrapper Do is used by multiple larger Do at the same time, only one Value instance is created. The underlying Value will be released only once, when all users release the wrapper Do.

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  33. def unapply[Value](doValue: Do[Value]): Some[UnitContinuation[Releasable[UnitContinuation, Try[Value]]]]

    Permalink

    Returns the underlying com.thoughtworks.future.continuation.UnitContinuation that creates a covariant.Releasable Value.

  34. final def wait(): Unit

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

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

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

Inherited from AnyRef

Inherited from Any

Converters

Type classes

Ungrouped