Object

com.thoughtworks.zerocost.raii

Raii

Related Doc: package raii

Permalink

object Raii

The companion object of Raii

Source
raii.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Raii
  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[A](parallelTryT: Parallel[[+β$11$]TryT[[+β$10$]ResourceT[[+A]Continuation[Unit, A], β$10$], β$11$], A]): Raii[A]

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def async[A](start: ((Resource[UnitContinuation, Try[A]]) ⇒ Unit) ⇒ Unit): Raii[A]

    Permalink
  7. def autoCloseable[A <: AutoCloseable](value: ⇒ A): Raii[A]

    Permalink

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

    Returns a non-strict Raii whose release operation is java.lang.AutoCloseable.close. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii.

    See also

    delay for non-strict garbage collected Raii

    pure for strict garbage collected Raii

  8. def autoCloseable[A <: AutoCloseable](continuation: UnitContinuation[A], dummyImplicit: DummyImplicit = DummyImplicit.dummyImplicit): Raii[A]

    Permalink

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

    Returns a non-strict Raii whose release operation is java.lang.AutoCloseable.close. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii.

    See also

    monadicCloseable for creating a Raii whose release operation is raii.

    delay for non-strict garbage collected Raii

    pure for strict garbage collected Raii

  9. def autoCloseable[A <: AutoCloseable](future: Task[A]): Raii[A]

    Permalink

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

    Returns a non-strict Raii whose release operation is java.lang.AutoCloseable.close. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii.

    See also

    monadicCloseable for creating a Raii whose release operation is raii.

    delay for non-strict garbage collected Raii

    pure for strict garbage collected Raii

  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def delay[A](value: ⇒ A): Raii[A]

    Permalink

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

    Returns a non-strict Raii whose release operation is no-op. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii. A must be a garbage-collected type that does not hold native resource.

    See also

    autoCloseable for auto-closeable Raii

    pure for strict garbage collected Raii

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  14. def execute[A](value: ⇒ A)(implicit executorContext: ExecutionContext): Raii[A]

    Permalink

    Returns a Raii that runs in executorContext.

    Returns a Raii that runs in executorContext.

    Note

    This method is usually used for changing the current thread.

    import java.util.concurrent._
    import scala.concurrent._
    import cats.syntax.all._
    import com.thoughtworks.zerocost.task._
    import com.thoughtworks.zerocost.raii._
    implicit def executorContext = ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor())
    val mainThread = Thread.currentThread
    val assertionRaii = for {
      _ <- Raii.delay(())
      threadBeforeJump = Thread.currentThread
      _ = threadBeforeJump should be(mainThread)
      _ <- Raii.execute(())
      threadAfterJump = Thread.currentThread
    } yield {
      threadAfterJump shouldNot be(mainThread)
    }
    assertionRaii.run.toFuture

    Returns a non-strict Raii whose release operation is no-op. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii.

    See also

    autoCloseable for auto-closeable Raii

    pure for strict garbage collected Raii

  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def garbageCollected[A](continuation: UnitContinuation[A], dummyImplicit: DummyImplicit = DummyImplicit.dummyImplicit): Raii[A]

    Permalink

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

    Returns a non-strict Raii whose release operation is no-op. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii. A must be a garbage-collected type that does not hold native resource.

    See also

    delay for non-strict garbage collected Raii

    autoCloseable for auto-closeable Raii

    pure for strict garbage collected Raii

  17. def garbageCollected[A](future: Task[A]): Raii[A]

    Permalink

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

    Returns a non-strict Raii whose release operation is no-op. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii. A must be a garbage-collected type that does not hold native resource.

    See also

    delay for non-strict garbage collected Raii

    autoCloseable for auto-closeable Raii

    pure for strict garbage collected Raii

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

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

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

    Permalink
    Definition Classes
    Any
  21. def monadicCloseable[A <: MonadicCloseable[UnitContinuation]](value: ⇒ A): Raii[A]

    Permalink

    Returns a non-strict Raii whose release operation is raii.

    Returns a non-strict Raii whose release operation is raii. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii.

    See also

    autoCloseable for auto-closeable Raii

    delay for non-strict garbage collected Raii

    pure for strict garbage collected Raii

  22. def monadicCloseable[A <: MonadicCloseable[UnitContinuation]](future: UnitContinuation[A], dummyImplicit: DummyImplicit = DummyImplicit.dummyImplicit): Raii[A]

    Permalink

    Returns a non-strict Raii whose release operation is raii.

    Returns a non-strict Raii whose release operation is raii. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii.

    See also

    autoCloseable for auto-closeable Raii

    delay for non-strict garbage collected Raii

    pure for strict garbage collected Raii

  23. def monadicCloseable[A <: MonadicCloseable[UnitContinuation]](future: Task[A]): Raii[A]

    Permalink

    Returns a non-strict Raii whose release operation is raii.

    Returns a non-strict Raii whose release operation is raii. Since the Raii is non-strict, A will be recreated each time it is sequenced into a larger Raii.

    See also

    autoCloseable for auto-closeable Raii

    delay for non-strict garbage collected Raii

    pure for strict garbage collected Raii

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

    Permalink
    Definition Classes
    AnyRef
  25. def nested[A](raiiA: Raii[A]): Raii[A]

    Permalink

    Returns a nested scope of raiiA.

    Returns a nested scope of raiiA.

    All resources created during building A will be released after A is built.

    Note

    This method has the same behavior as Raii.garbageCollected(raiiA.run).

    ,

    A must be a garbage collected type, i.e. not a java.lang.AutoCloseable or a resourcet.MonadicCloseable

    See also

    AsynchronousRaiiOps.run for running a Raii as a Task.

    garbageCollected for creating a garbage collected Raii

  26. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  28. def pure[A](value: A): Raii[A]

    Permalink

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

    Converts a strict value to a Raii whose release operation is no-op. A must be a garbage-collected type that does not hold native resource.

    See also

    autoCloseable for auto-closeable Raii

    delay for non-strict garbage collected Raii

  29. def resource[A](resource: ⇒ Resource[UnitContinuation, A]): Raii[A]

    Permalink
  30. def safeAsync[A](start: ((Resource[UnitContinuation, Try[A]]) ⇒ TailRec[Unit]) ⇒ TailRec[Unit]): Raii[A]

    Permalink
  31. def suspend[A](doValue: ⇒ Raii[A]): Raii[A]

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  34. def unapply[A](raii: Raii[A]): Some[Parallel[[+β$12$]TryT[[+β$13$]ResourceT[[+A]Continuation[Unit, A], β$13$], β$12$], A]]

    Permalink
  35. final def wait(): Unit

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

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

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

Deprecated Value Members

  1. def scoped[A <: AutoCloseable](future: UnitContinuation[A], dummyImplicit: DummyImplicit = DummyImplicit.dummyImplicit): Raii[A]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0) Use autoCloseable instead.

  2. def scoped[A <: AutoCloseable](future: Task[A]): Raii[A]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0) Use autoCloseable instead.

Inherited from AnyRef

Inherited from Any

Ungrouped