trait CloseOnce extends Closable
A mixin trait to describe resources that are an idempotent Closable.
The first call to close(Time)
triggers closing the resource with the
provided deadline while subsequent calls will yield the same Future
as the first invocation irrespective of the deadline provided.
- Self Type
- CloseOnce with Closable
- Note
this mixin extends Closable as a workaround for extending AbstractClosableOnce in Java. The mixin's final override is not recognized when compiled with Scala 3. See CSL-11187 or https://github.com/lampepfl/dotty/issues/13104.
- See also
ClosableOnce if you are not mixing in or extending an existing Closable
ClosableOnce.of for creating a proxy to a Closable that has already been instantiated.
- Alphabetic
- By Inheritance
- CloseOnce
- Closable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def closeOnce(deadline: Time): Future[Unit]
Close the resource with the given deadline exactly once.
Close the resource with the given deadline exactly once. This deadline is advisory, giving the callee some leeway, for example to drain clients or finish up other tasks.
- Attributes
- protected
- Note
if this method throws a synchronous exception, that exception will be wrapped in a failed future. If a fatal error is thrown synchronously, the error will be wrapped in a failed Future AND thrown directly.
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 asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def close(deadline: Time): Future[Unit]
Close the resource with the given deadline.
- def close(after: Duration): Future[Unit]
Close the resource with the given timeout.
Close the resource with the given timeout. This timeout is advisory, giving the callee some leeway, for example to drain clients or finish up other tasks.
- Definition Classes
- Closable
- final def close(): Future[Unit]
Close the resource.
Close the resource. The returned Future is completed when the resource has been fully relinquished.
- Definition Classes
- Closable
- final def closeFuture: Future[Unit]
The Future satisfied upon completion of close.
- Attributes
- protected
- Note
we do not expose direct access to the underlying closePromise, because the Promise state is mutable - we only want mutation to occur within this CloseOnce trait.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isClosed: Boolean
Signals whether or not this Closable has been closed.
- 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()