Class/Object

fm.lazyseq

LazySeqBuilder

Related Docs: object LazySeqBuilder | package lazyseq

Permalink

final class LazySeqBuilder[A] extends BuilderCompat[A, LazySeq[A]] with Closeable with Logging

A LazySeq producer/consumer pair that uses a BlockingQueue

I think this is Thread-Safe

2021-02-19 - This was updated to allow passing in an arbitrary BlockingQueue implementation (e.g. an LMDBBlockingDeque for using an off-heap disk-backed queue). I removed the END_OF_QUEUE marker so that the BlockingQueue could be typed as a BlockingQueue[A] instead of an BlockingQueue[AnyRef] to make serialization in LMDBBlockingDeque work better.

It looks like there is a lot of cleanup potential in this class. After some original threading problems around handling exceptions in the Producer and Consumer threads it looks like I went a little overboard on error handling. There is probably room for a lot of simplification.

Self Type
LazySeqBuilder[A]
Linear Supertypes
Logging, Closeable, AutoCloseable, BuilderCompat[A, LazySeq[A]], GrowableCompat[A], Builder[A, LazySeq[A]], scala.collection.generic.Growable[A], Clearable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LazySeqBuilder
  2. Logging
  3. Closeable
  4. AutoCloseable
  5. BuilderCompat
  6. GrowableCompat
  7. Builder
  8. Growable
  9. Clearable
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LazySeqBuilder()

    Permalink
  2. new LazySeqBuilder(queueSize: Int)

    Permalink
  3. new LazySeqBuilder(queueSize: Int, shutdownJVMOnUncaughtException: Boolean)

    Permalink
  4. new LazySeqBuilder(queue: BlockingQueue[A], shutdownJVMOnUncaughtException: Boolean = false)

    Permalink

Type Members

  1. class lazySeq extends WithFilterCompat[A, LazySeq] with BufferedLazySeq[A] with Closeable

    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 ++=(elems: TraversableOnce[A]): LazySeqBuilder.this.type

    Permalink
    Definition Classes
    GrowableCompat
    Annotations
    @inline()
  4. final def ++=(elems: TraversableOnceOrIterableOnce[A]): LazySeqBuilder.this.type

    Permalink
    Definition Classes
    GrowableCompat → Growable
    Annotations
    @inline()
  5. final def +=(elem: A): LazySeqBuilder.this.type

    Permalink
    Definition Classes
    GrowableCompat → Growable
    Annotations
    @inline()
  6. def +=(elem1: A, elem2: A, elems: A*): LazySeqBuilder.this.type

    Permalink
    Definition Classes
    Growable
  7. final def ==(arg0: Any): Boolean

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

    Permalink

    This will abort both the producer and consumer possibly removing items from the queue to make room for our END_OF_QUEUE marker.

  9. def abortConsumer(): Unit

    Permalink
  10. def abortProducer(): Unit

    Permalink
  11. def addAll(elems: TraversableOnce[A]): LazySeqBuilder.this.type

    Permalink
    Definition Classes
    GrowableCompat
  12. def addAll(elems: TraversableOnceOrIterableOnce[A]): LazySeqBuilder.this.type

    Permalink
    Definition Classes
    GrowableCompat
  13. def addOne(v: A): LazySeqBuilder.this.type

    Permalink
    Definition Classes
    LazySeqBuilder → GrowableCompat
  14. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  15. def await(): Unit

    Permalink

    Wait for both the producer and consumer threads (if any) to finish

  16. def awaitConsumer(): Unit

    Permalink

    Wait for the consumer thread (if any) to finish

  17. def awaitProducer(): Unit

    Permalink

    Wait for the producer thread (if any) to finish

  18. def clear(): Unit

    Permalink
    Definition Classes
    LazySeqBuilder → Builder → Growable → Clearable
  19. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  20. def close(): Unit

    Permalink

    Note: It's not clear what the correct behavior of this method is.

    Note: It's not clear what the correct behavior of this method is. It will currently block until the producer/consumer threads have cleanly finished.

    Definition Classes
    LazySeqBuilder → Closeable → AutoCloseable
  21. def closeConsumer(): Unit

    Permalink
  22. def closeProducer(): Unit

    Permalink
  23. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  26. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. final def isProducerOrConsumerThread(): Boolean

    Permalink
    Attributes
    protected
  29. lazy val lazySeq: lazySeq

    Permalink
  30. lazy val logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  31. def mapResult[NewTo](f: (LazySeq[A]) ⇒ NewTo): Builder[A, NewTo]

    Permalink
    Definition Classes
    Builder
  32. final def ne(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  34. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  35. def queueSize: Int

    Permalink
  36. def result(): LazySeq[A]

    Permalink
    Definition Classes
    LazySeqBuilder → Builder
  37. def sizeHint(coll: TraversableLike[_, _], delta: Int): Unit

    Permalink
    Definition Classes
    Builder
  38. def sizeHint(coll: TraversableLike[_, _]): Unit

    Permalink
    Definition Classes
    Builder
  39. def sizeHint(size: Int): Unit

    Permalink
    Definition Classes
    Builder
  40. def sizeHintBounded(size: Int, boundingColl: TraversableLike[_, _]): Unit

    Permalink
    Definition Classes
    Builder
  41. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    AnyRef → Any
  43. val uniqueId: Int

    Permalink
    Attributes
    protected
  44. final def wait(arg0: Long, arg1: Int): Unit

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. def withConsumerThread(f: (LazySeq[A]) ⇒ Unit): LazySeqBuilder.this.type

    Permalink
  48. def withProducerThread(f: (Growable[A]) ⇒ Unit): LazySeqBuilder.this.type

    Permalink

    Run the function in a separate producer thread.

    Run the function in a separate producer thread. Should only be called once since it will close the Builder when the thread finishes.

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from Logging

Inherited from Closeable

Inherited from AutoCloseable

Inherited from BuilderCompat[A, LazySeq[A]]

Inherited from GrowableCompat[A]

Inherited from Builder[A, LazySeq[A]]

Inherited from scala.collection.generic.Growable[A]

Inherited from Clearable

Inherited from AnyRef

Inherited from Any

Ungrouped