Class/Object

zio.internal

WeakConcurrentBag

Related Docs: object WeakConcurrentBag | package internal

Permalink

class WeakConcurrentBag[A] extends AnyRef

A WeakConcurrentBag stores a collection of values, each wrapped in a WeakReference. The structure is optimized for addition, and will achieve zero allocations in the happy path (aside from the allocation of the WeakReference, which is unavoidable). To remove a value from the bag, it is sufficient to clear the corresponding weak reference, at which point the weak reference will be removed from the bag during the next garbage collection.

Garbage collection happens regularly during the add operation. Assuming uniform distribution of hash codes of values added to the bag, the chance of garbage collection occurring during an add operation is 1/n, where n is the capacity of the table backing the bag.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WeakConcurrentBag
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new WeakConcurrentBag(tableSize: Int)

    Permalink

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. final def add(value: A): WeakReference[A]

    Permalink

    Adds the specified value to the concurrent bag, returning a WeakReference that wraps the value.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def gc(): Unit

    Permalink

    Performs garbage collection, removing any empty weak references.

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

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

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

    Permalink
    Definition Classes
    Any
  14. final def iterator: Iterator[A]

    Permalink

    Returns a weakly consistent iterator over the bag.

    Returns a weakly consistent iterator over the bag. This iterator will never throw exceptions even in the presence of concurrent modifications.

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

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  18. final def size: Int

    Permalink

    Returns the size of the bag.

    Returns the size of the bag. Due to concurrent modification, this is only an estimate. Note this operation is O(n.max(m)), where n is the number of elements in the collection, and m is the table size.

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

    Permalink
    Definition Classes
    AnyRef
  20. final def toString(): String

    Permalink
    Definition Classes
    WeakConcurrentBag → AnyRef → Any
  21. final def wait(): Unit

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped