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
.
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
.
monadicCloseable for creating a Raii
whose release operation is raii.
delay for non-strict garbage collected Raii
pure for strict garbage collected Raii
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
.
monadicCloseable for creating a Raii
whose release operation is raii.
delay for non-strict garbage collected Raii
pure for strict garbage collected Raii
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.
autoCloseable for auto-closeable Raii
pure for strict garbage collected Raii
Returns a Raii
that runs in executorContext
.
Returns a Raii
that runs in executorContext
.
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
.
autoCloseable for auto-closeable Raii
pure for strict garbage collected Raii
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.
delay for non-strict garbage collected Raii
autoCloseable for auto-closeable Raii
pure for strict garbage collected Raii
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.
delay for non-strict garbage collected Raii
autoCloseable for auto-closeable Raii
pure for strict garbage collected Raii
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
.
autoCloseable for auto-closeable Raii
delay for non-strict garbage collected Raii
pure for strict garbage collected Raii
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
.
autoCloseable for auto-closeable Raii
delay for non-strict garbage collected Raii
pure for strict garbage collected Raii
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
.
autoCloseable for auto-closeable Raii
delay for non-strict garbage collected Raii
pure for strict garbage collected Raii
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.
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
AsynchronousRaiiOps.run for running a Raii
as a Task.
garbageCollected for creating a garbage collected Raii
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.
autoCloseable for auto-closeable Raii
delay for non-strict garbage collected Raii
(Since version 3.0.0) Use autoCloseable instead.
(Since version 3.0.0) Use autoCloseable instead.
The companion object of Raii