Class/Object

zio.internal

MutableConcurrentQueue

Related Docs: object MutableConcurrentQueue | package internal

Permalink

abstract class MutableConcurrentQueue[A] extends AnyRef

A MutableConcurrentQueue interface to use under the hood in ZIO.

The implementation at minimum: 1. Should be non-blocking and ideally lock-free. 2. Should provide basic metrics such as how many elements were enqueued/dequeued.

Attributes
protected[zio]
Note

this is declared as abstract class since invokevirtual is slightly cheaper than invokeinterface.

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

Instance Constructors

  1. new MutableConcurrentQueue()

    Permalink

Abstract Value Members

  1. abstract val capacity: Int

    Permalink

    The maximum number of elements that a queue can hold.

    The maximum number of elements that a queue can hold.

    Note

    that unbounded queues can still implement this interface with capacity = MAX_INT.

  2. abstract def dequeuedCount(): Long

    Permalink

    returns

    the number of elements that have ever been taken from the queue.

    Note

    if you know how much time the queue is alive, you can calculate the rate at which elements are being dequeued.

  3. abstract def enqueuedCount(): Long

    Permalink

    returns

    the number of elements that have ever been added to the queue.

    Note

    if you know how much time the queue is alive, you can calculate the rate at which elements are being enqueued.

    ,

    that scala.Long is used here, since scala.Int will be overflowed really quickly for busy queues.

  4. abstract def isEmpty(): Boolean

    Permalink
  5. abstract def isFull(): Boolean

    Permalink
  6. abstract def offer(a: A): Boolean

    Permalink

    A non-blocking enqueue.

    A non-blocking enqueue.

    returns

    whether the enqueue was successful or not.

  7. abstract def poll(default: A): A

    Permalink

    A non-blocking dequeue.

    A non-blocking dequeue.

    returns

    either an element from the queue, or the default param.

    Note

    that if there's no meaningful default for your type, you can always use poll(null). Not the best, but reasonable price to pay for lower heap churn from not using scala.Option here.

  8. abstract def size(): Int

    Permalink

    returns

    the current number of elements inside the queue.

    Note

    that this method can be non-atomic and return the approximate number in a concurrent setting.

Concrete 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 asInstanceOf[T0]: T0

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

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

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

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

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

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  15. def offerAll(as: Iterable[A]): Chunk[A]

    Permalink

    A non-blocking enqueue of multiple elements.

  16. def pollUpTo(n: Int): Chunk[A]

    Permalink

    A non-blocking dequeue of multiple elements.

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

    Permalink
    Definition Classes
    AnyRef
  18. def toString(): String

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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped