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. Alphabetic
  2. 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](tryT: TryT[[+β$1$]ResourceT[[+A]Continuation[Unit, A], β$1$], 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.

    Value must be a garbage-collected type that does not hold native resource.

    See also

    scoped for auto-closeable Do

    now for strict garbage collected Do

  8. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  10. def execute[Value](value: ⇒ Value)(implicit executorContext: ExecutionContext): Do[Value]

    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._
    implicit def executorContext = ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor())
    val mainThread = Thread.currentThread
    Do.run {
      for {
        _ <- Do.delay(())
        threadBeforeJump = Thread.currentThread
        _ = threadBeforeJump should be(mainThread)
        _ <- Do.execute(())
        threadAfterJump = Thread.currentThread
      } yield {
        threadAfterJump shouldNot be(mainThread)
      }
    }

    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

  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def garbageCollected[Value](contT: 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.

    Value must be a garbage-collected type that does not hold native resource.

    See also

    delay for non-strict garbage collected Do

    scoped for auto-closeable Do

    now for strict garbage collected Do

  13. def garbageCollected[Value](continuation: UnitContinuation[Value], dummyImplicit: DummyImplicit = DummyImplicit.dummyImplicit): 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.

    Value must be a garbage-collected type that does not hold native resource.

    See also

    delay for non-strict garbage collected Do

    scoped for auto-closeable Do

    now for strict garbage collected Do

  14. def garbageCollected[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.

    Value must be a garbage-collected type that does not hold native resource.

    See also

    delay for non-strict garbage collected Do

    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. def intransitiveFlatMap[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, for those B do not reference to A or A is a garbage collected object.

    Returns a Do of B based on a Do of Value and a function that creates a Do of B, for those B do not reference to A or A is a garbage collected object.

    Note

    intransitiveFlatMap is similar to flatMap in doMonadErrorInstances, except intransitiveFlatMap will release Value right after B is created. Don't use this method if you need to retain A until B is released.

  18. def intransitiveMap[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, for those B do not reference to A or A is a garbage collected object.

    Returns a Do of B based on a Do of Value and a function that creates B, for those B do not reference to A or A is a garbage collected object.

    Note

    intransitiveMap is similar to map in doMonadErrorInstances, except intransitiveMap will release Value right after B is created. Don't use this method if you need to retain A until B is released.

  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  23. 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.

    Value must be a garbage-collected type that does not hold native resource.

    See also

    scoped for auto-closeable Do

    delay for non-strict garbage collected Do

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

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

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

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

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

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

    Permalink

    Converts doValue to a reference counted wrapper.

    Converts doValue to a reference counted wrapper.

    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.

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  32. def unapply[Value](doValue: Do[Value]): Some[TryT[[+β$2$]ResourceT[[+A]Continuation[Unit, A], β$2$], Value]]

    Permalink
  33. final def wait(): Unit

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped