Packages

class TwoPhasePriorityAccumulator[A, B] extends AnyRef

A container with two phases for items with priorities:

  1. In the accumulation phase, items can be added with a priority via TwoPhasePriorityAccumulator.accumulate.
  2. In the draining phase, items can be removed in priority order via TwoPhasePriorityAccumulator.drain. The order of items with equal priority is unspecified.

TwoPhasePriorityAccumulator.stopAccumulating switches from the accumulation phase to the draining phase. Items can be removed from the container via the handle returned by TwoPhasePriorityAccumulator.accumulate.

A

The type of items to accumulate

B

The type of labels for the draining phase

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

Instance Constructors

  1. new TwoPhasePriorityAccumulator(obsoleteO: Option[(A) => Boolean])

    obsoleteO

    Optional function to identify obsolete items. Obsolete items are regularly removed during the accumulation phase.

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. def accumulate(item: A, priority: Priority): Either[B, ItemHandle]

    Adds the given item with the given priority, if this container is still in the accumulation phase, and returns a handle to remove it.

    Adds the given item with the given priority, if this container is still in the accumulation phase, and returns a handle to remove it. If the container is already in the draining phase, the item is not added and instead the draining phase label is returned.

    The same item can be added multiple times, with the same or different priorities, and the container then holds it multiple times. Accordingly, the item will appear as many times during draining as it was added and not removed, unless it has become obsolete.

  5. def afterRegistration(): Unit

    Hook for testing interesting interleavings

    Hook for testing interesting interleavings

    Attributes
    protected
    Annotations
    @VisibleForTesting()
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  8. def drain()(implicit errorLoggingContext: ErrorLoggingContext): Iterator[(A, Priority)]

    Returns an iterator over the items to be drained in priority order.

    Returns an iterator over the items to be drained in priority order. Lower priority values are drained first.

    May only be called during the draining phase.

    An item is to be drained if all of the following conditions apply:

    • It was added during the accumulation phase.
    • It has not yet been successfully removed via the handle.
    • It has not yet been garbage-collected because it was obsolete at some point since it was added.

    If called multiple times during the draining phase, each returned iterator yields only a subset of the items to be drained, respecting the priority order within the subset. All these iterators jointly return all items to be drained with their correct multiplicity.

    The returned iterator is not thread-safe: it must not be used from multiple threads without explicit synchronization.

    Exceptions thrown

    java.lang.IllegalStateException if called during the accumulation phase

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  12. def getPhase: Option[B]

    Returns scala.None$ in the accumulating phase, and scala.Some$ with the label of the draining phase.

  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  14. def isAccumulating: Boolean

    Whether this class is still in the accumulation phase

  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  19. def stopAccumulating(b: B): Option[B]

    Switches from the accumulation phase to the draining phase.

    Switches from the accumulation phase to the draining phase. Only the first call to this method is effective; all subsequent calls are ignored.

    b

    The label for the draining phase

  20. def stopAndDrain(b: B)(implicit errorLoggingContext: ErrorLoggingContext): Iterator[(A, Priority)]
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  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()
  25. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped