Packages

t

com.twitter.util

CloseOnce

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.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CloseOnce
  2. Closable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def close(deadline: Time): Future[Unit]

    Close the resource with the given deadline.

    Close the resource with the given deadline. This deadline is advisory, giving the callee some leeway, for example to drain clients or finish up other tasks.

    Definition Classes
    CloseOnceClosable
  7. 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
  8. 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
  9. final def closeFuture: Future[Unit]

    The Future satisfied upon completion of close.

    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.

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isClosed: Boolean

    Signals whether or not this Closable has been closed.

    Signals whether or not this Closable has been closed.

    returns

    return true if close has been initiated, false otherwise

  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Closable

Inherited from AnyRef

Inherited from Any

Ungrouped