trait Scope extends Serializable
A Scope
is the foundation of safe, composable resource management in ZIO. A
scope has two fundamental operators, addFinalizer
, which adds a finalizer
to the scope, and close
, which closes a scope and runs all finalizers that
have been added to the scope.
- Self Type
- Scope
- Alphabetic
- By Inheritance
- Scope
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def addFinalizerExit(finalizer: (Exit[Any, Any]) => UIO[Any])(implicit trace: Trace): UIO[Unit]
Adds a finalizer to this scope.
Adds a finalizer to this scope. The finalizer is guaranteed to be run when the scope is closed.
- abstract def forkWith(executionStrategy: => ExecutionStrategy)(implicit trace: Trace): UIO[Closeable]
Forks a new scope that is a child of this scope.
Forks a new scope that is a child of this scope. Finalizers added to the child scope will be run according to the specified
ExecutionStrategy
. The child scope will automatically be closed when this scope is closed.
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
- final def addFinalizer(finalizer: => UIO[Any])(implicit trace: Trace): UIO[Unit]
A simplified version of
addFinalizerWith
when thefinalizer
does not depend on theExit
value that the scope is closed with. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def executionStrategy: ExecutionStrategy
The execution strategy finalizers associated with this scope will be run with.
- final def extend[R]: ExtendPartiallyApplied[R]
Extends the scope of a
ZIO
workflow that needs a scope into this scope by providing it to the workflow but not closing the scope when the workflow completes execution.Extends the scope of a
ZIO
workflow that needs a scope into this scope by providing it to the workflow but not closing the scope when the workflow completes execution. This allows extending a scoped value into a larger scope. - final def fork(implicit trace: Trace): UIO[Closeable]
Forks a new scope that is a child of this scope.
Forks a new scope that is a child of this scope. Finalizers added to this scope will be run sequentially in the reverse of the order in which they were added when this scope is closed. The child scope will automatically be closed when this scope is closed.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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()